Код: Выделить всё
public function selecionar($where = NULL, $limit = NULL, $order_by = NULL)
{
if (!is_null($where)) {
$this->db->where($where);
}
if (!is_null($limit)) {
$this->db->limit($limit);
}
if (!is_null($order_by)) {
$this->db->order_by($order_by);
}
return $this->db->get(_LOTE_);//_LOTE_ is a constant for my table name
}
Код: Выделить всё
$config['per_page'] = '5';
$limite = $config['per_page'] . ',' . $this->uri->segment(3); //the segment is ok, I receive it
$lotes = $this->LoteModel->selecionar(array('quadra_id' => $quadra_id, 'lote_status' => 1), $limite, 'lote_endereco');
Код: Выделить всё
SELECT * FROM (`realestate_lote`) WHERE `quadra_id` = '1' AND `lote_status` = 1 ORDER BY `lote_endereco`
Я работаю с нумерацией страниц.>
Подробнее здесь: https://stackoverflow.com/questions/605 ... rs-query-b
Мобильная версия