Pagination error in CI - 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 error in CI (/showthread.php?tid=40239) |
Pagination error in CI - El Forum - 04-03-2011 [eluser]_just_me[/eluser] Hello, I'm having an issue with pagination in that the links are not displayed. The problem occurred as soon as I added the $num and $offset vars into the model, I'm guessing that my syntax is incorrect and would appreciate it if someone glances their eye over it and can't point me in the right direction. The model in question is: Quote: function getAllMusic($num,$offset){ It works fine in displaying all records and the pagination links without this line: Code: $this->db->limit($num,$offset); _just_me Pagination error in CI - El Forum - 04-03-2011 [eluser]InsiteFX[/eluser] What you need to show is your pagination code! InsiteFX Pagination error in CI - El Forum - 04-03-2011 [eluser]_just_me[/eluser] Ooops, sorry - was a long night. Here's the controller Code: function index() and here's the pertinent bit from the view: Code: <? echo $pagination; ?> Thanks, Matt Pagination error in CI - El Forum - 04-03-2011 [eluser]InsiteFX[/eluser] You need to add this for one: Code: $config['uri_segment'] = 3; InsiteFX Pagination error in CI - El Forum - 04-03-2011 [eluser]_just_me[/eluser] Thanks for the response. I've added the config option in, but still have no joy in getting the links to display. When the limit() line is moved from the model, the links reappear but then of course it's not limiting the results. Completely stumped. Thanks, _just_me Pagination error in CI - El Forum - 04-03-2011 [eluser]InsiteFX[/eluser] Pagination with CodeIgniter InsiteFX Pagination error in CI - El Forum - 04-03-2011 [eluser]_just_me[/eluser] Just in case anyone stumbles across this - I was stupidly populating the per_page with a count from the query that was grabbing the data, instead of running a separate count_all query. Thanks for the link InsiteFX. _just_me Pagination error in CI - El Forum - 04-03-2011 [eluser]InsiteFX[/eluser] Your very Welcome. Pagination is a little confusing at first but once you get use to it no problem. InsiteFX |