标签:pre param limit set exp mysq row 获取 params
以下是高效的查询方式
//获取列表 public function getList($params, $pageSize, $p){ $limit = ($p - 1) * $pageSize; $limit.=",{$pageSize}"; $getWhere = $this -> getWhere($params); $sql = "SELECT SQL_CALC_FOUND_ROWS * from exp_catalog {$getWhere} order by `catid` desc LIMIT {$limit}"; $sqlCount = "SELECT FOUND_ROWS() as count"; $list = $this->db->find($sql); $count_data = $this->db->find($sqlCount);//返回数组 $total = isset($count_data[0][‘count‘]) ? $count_data[0][‘count‘] : 0; return array(‘list‘ => $list, ‘total‘ => $total); }
标签:pre param limit set exp mysq row 获取 params
原文地址:http://www.cnblogs.com/xs-yqz/p/6217078.html