Thursday, 13 March 2014

Codeigniter active record get query without the LIMIT clause



$this->db
->select("SQL_CALC_FOUND_ROWS emp", FALSE)->from('emp')->join('empr', 'empr.b = empr.id', 'left')->like('code', $code)->limit($numrows, $start);

$q = $this->db->get();
Then after that query is ran, we need run another query to get the total number of rows.
$query = $this->db->query('SELECT FOUND_ROWS() AS `Count`');
$data["totalres"] = $query->row()->Count;

No comments:

Post a Comment