Jump to content

Paginate rows day by day in PHP/MySQL


silvercover

Recommended Posts

I have a MySQL query that returns rows containing date_add column like below:

DATE(date_add)
2014-01-07
2014-01-07
2014-01-07
2014-01-07
2014-01-08
2014-01-15
2014-01-20
2014-01-20
2014-01-20
2014-01-26
2014-01-28
2014-02-16
2014-02-16
2014-02-16
2014-02-16
2014-02-16
2014-02-16
2014-02-16
2014-02-18
2014-02-18
2014-03-08
2014-03-08

How can I have pagination based on dates and show rows with the same date in a page and not just based on predefined limit number?

Link to comment
https://forums.phpfreaks.com/topic/293777-paginate-rows-day-by-day-in-phpmysql/
Share on other sites

you would actually do 'date-ination', where your links cause specific or next/previous dates to be selected, not logical page numbers.

 

you can get a unique list of distinct dates and make a link for each one, displaying only the first one, a small range around the currently selected date, and the last one and/or you can make links with the currently selected date and a next/previous flag that would query for the next highest or lowest date from the selected date.

 

if your dates can have a large number of results for any day, you may still want to have traditional pagination for the results. your links would just be built with the 'date-ination' selection and the logical page numbers for the pagination.

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.