Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Suggestions on Pagination? Re: Suggestions on Pagination?

#84248
ddliu
Member

First of all, the list of data should be sortable(e.g. by related time, or by place, or sorted by order which is maintained manually).

Take following list for example:


TABLE "links":
#id #time #place #disp_order
1 ... New York 3
2 ... Devizes 5
3 ... London 1

So when showing entry #2, it will be:

New York …

<< Prev is London Next is Devizes >>

For data retrieving:
#1. Get data entry of #1 New York($entry)
#2. Get prev entry:


SELECT id, place FROM links WHERE disp_order < $entry ORDER BY disp_order LIMIT 1

#3. Get next entry:


SELECT id, place FROM links WHERE disp_order > $entry ORDER BY disp_order DESC LIMIT 1

Hope it helps.