[cgiapp] Q: Any guidelines for paging thru db records via CGI params?

Bradley C Bailey cgiapp at brad.memoryleak.org
Tue May 27 21:16:30 EDT 2008


> Understood, but Rose handles those sorts of things. And I use Postgres,
> but other users of my code may not.
> As I said in another reply, I'm fishing for ideas on how to display
> these options in the web client, for the user's benefit.

I usually just give the user a preset list of options for how many items 
to display per page (10, 25, 50, 100).  Then they can just page through 
the results.  I often will display this at the top right corner of the 
list.  You could also use some kind of preferences page if you have 
users that log in.

I like to display the page options at the bottom in this format:

< Prev  1 2 ...  7 8 *9* 10 11  ...  19 20  Next >

By always showing the first 2 and last 2 pages, the user has an easy way 
to first and last page and they get an idea of how many pages there are. 
  There's no need to have a special 'First' and 'Last' link if you do it 
this way.

Here is a good site with tips and examples of pagination:


Hope this helps.

Bradley C Bailey

More information about the cgiapp mailing list