我已经在我的模型以下功能:导致下面的查询$this->the_model->getLocations()
:笨活动记录限制与加盟
SELECT *
FROM "location"
JOIN "process" ON "process"."process_id"="location"."process_id"
JOIN "line" ON "line"."line_id"="process"."line_id"
ORDER BY "location_id" asc LIMIT 0
通知LIMIT 0
,这确实
function getLocations($limit = null, $offset = null){
$this->db->select('*');
$this->db->from('location');
$this->db->join('process', 'process.process_id=location.process_id');
$this->db->join('line', 'line.line_id=process.line_id');
$this->db->limit($limit, $offset);
$this->db->order_by('location_id', 'asc');
return $this->db->get()->result();
}
它然后使用执行当我执行$this->db->order_by('item_id', 'asc')->get('item', $limit, $offset)->result()
时不会发生。没有LIMIT 0
甚至限制和抵消是null
。那么,如何解决这个问题呢?限制为空时,我已经添加了if
条件。
嗨,null并不意味着是= 0,你可以尝试做功能getLocations($ limit = 0,$ offset = 0) –