Jump to content

The right way to do pagination


tibberous

Recommended Posts

You learn something new everyday:

 

http://www.arraystudio.com/as-workshop/mysql-get-total-number-of-rows-when-using-limit.html

 

Basically, rather than having to do a query twice, you can do it once, then do a second query to get the amount of total results. Not only is it better performance wise, but you don't need to have conditions in 2 places (and it avoids the bug where the queries are out of sync, and you'll have like 8 pages but only 2 real pages of results)

Link to comment
https://forums.phpfreaks.com/topic/193703-the-right-way-to-do-pagination/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.