CodeIgniter Forums
Pagination problem, offset seem to be not working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Pagination problem, offset seem to be not working (/showthread.php?tid=51477)



Pagination problem, offset seem to be not working - El Forum - 05-05-2012

[eluser]ReyPM[/eluser]
Hi, I'm having some problems with my pagination because for some reason the parameter at URL is always 10 and not 20 like I want. This is my code:
Code:
$offset_exists = $this->uri->segment(3);
$offset = $offset_exists ? 20 : 0;
        
keyword = $this->Convertedkitcylinder_model->keyword_handler($this->input->get_post('keyword', TRUE));
$total = $this->Convertedkitcylinder_model->AjaxSearchTotal($keyword);
$output_string = $this->Convertedkitcylinder_model->AjaxSearch($keyword, 20, $offset);

$this->load->library('pagination');
$config['base_url'] = site_url('convertedkitcylinder/ajaxsearch');
$config['total_rows'] = $total;
$config['row_per_page'] = 20;
$config['num_links'] = 2;

But my URL looks like: convertedkitcylinder/ajaxsearch for the first run, convertedkitcylinder/ajaxsearch/10 for the second, convertedkitcylinder/ajaxsearch/20 when I'm showing 20 items per page and $total takes 26 as value so just 2 pagination must be showed instead I get 3, why?