[eluser]maria clara[/eluser]
hi,
i also encountered that one.. try this script.
Code:
$this->db->order_by($sidx,$sord);
$this->db->limit($limit, $start);
$query = $this->db->get('ar_so');
$count = $this->db->count_all_results();
// calculate the total pages for the query - code added by cess
if( $count > 0 && $limit > 0) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
// if for some reasons the requested page is greater than the total
// set the requested page to total page - code added by cess
if ($page > $total_pages) $page=$total_pages;
// calculate the starting position of the rows
$start = $limit * $page - $limit; // do not put $limit*($page - 1)
// if for some reasons start position is negative set it to 0
// typical case is that the user type 0 for the requested page
if($start <0) $start = 0;
$this->db->flush_cache();
$data['db'] = $query;
$data['page'] = $page;
$data['num'] = $total_pages;
$data['totalPages']=$count;
return $data;
hope it would help you..
regards,
maria