![]() |
Pagination Bug - 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 Bug (/showthread.php?tid=9537) |
Pagination Bug - El Forum - 06-29-2008 [eluser]Roosevelt![/eluser] Hello, I am not sure if it is a bug or an error in my code. For some reason when I generate the pagination links, it generates the links as: 1 2 3 4 Where page 3 is linking to 4. Code: $this->load->library('pagination'); So in a way, page three doesn't even exist. Pagination Bug - El Forum - 06-29-2008 [eluser]Référencement Google[/eluser] I think you inverted the total rows and per page, this should be: Code: $config['total_rows'] = $RowsPerPage; //using $this->db->count_all('products'); Pagination Bug - El Forum - 07-01-2008 [eluser]Roosevelt![/eluser] I typed the wrong code it is actually like this: $config['base_url'] = site_url('products/browse/$category/page'); $config['total_rows'] = $TotalRows; $config['per_page'] = $RowsPerPage; $config['uri_segment'] = 5; For testing purposes I set total_rows to 200, and per_page to 10, and removed the uri_segment config. From what I figured out is that the page_num variable actually holds the offset value. But what I was doing is reassinging the offset again using the following math: $offset = $pagenum * $rowsperpage. So it was generating weird results :p. |