Feature #2355: implement pagination
prev/next buttons are displayed on a table that has 100 entries
...while it shouldn't.
Because on pressing next button user gets empty list
#1 Updated by Andrii Arsirii 6 months ago
I almost never do two queries. Simply return one more row than is needed, only display 10 on the page, and if there are more than are displayed, display a "Next" button. SELECT x, y, z FROM `table` WHERE `some_condition` LIMIT 0, 11 // iterate through and display 10 rows. // if there were 11 rows, display a "Next" button. Your query should return in an order of most relevant first. Chances are, most people aren't going to care about going to page 236 out of 412. When you do a google search, and your results aren't on the first page, you likely go to page two, not nine.
Good idea, solves problem, and no speed impact.