[eluser]hvalente13[/eluser]
Hi Asinox,
You could do it like this in your model:
Code:
function get_results($param,$limit=15,$offset){
$this->db->select('*');
$this->db->where('field',$param);
$data['num_rows'] = $this->db->count_all_results('mytable');
$data['result'] = $this->db->get('mytable',$limit,$offset);
return $data;
}
and retrieve the data in the controller like this:
Code:
function index(){
$config['per_page'] = '10';
$all_result_set = $this->my_model->get_results('keyword',$config['per_page'],$this->uri->segment(3));
$config['total_rows']=$all_result_set['num_rows'];
$data['results']=$all_result_set['result'];
// the rest of pagination settings
}
Hope this helps.
Good luck