• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
codeigniter pagination: it shows the correct result until page 2 or 3

#2
When you set use_page_numbers to TRUE, you need to calculate the offset to be used by your model. You're just passing the page number in as the offset, which would work if you only show 1 item per page (except that your first page would probably skip the first result). If you assume in your model that you're going to receive a page number instead of an offset, you could probably $this->db->limit($limit, ($start - 1) * $limit) instead of $this->db->limit($limit, $start). Depending on how you're separating your responsibilities between model and controller, though, you may want to do the calculation in the controller, instead.
Reply


Messages In This Thread
RE: codeigniter pagination: it shows the correct result until page 2 or 3 - by mwhitney - 07-27-2015, 09:32 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.