Pagination for big sql table results

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Pagination for big sql table results

Post by Sindarin »

I found some nice pagination scripts and I am trying to implement them in my code,

The pagination would be like: http://www.wellho.net/demo/mqchunks.php

but in case there are many results like 500, I'd like to display
1,2,3,4,5,6,7....496,497,498,499,500
not the whole results.
How would I do that?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Pagination for big sql table results

Post by califdon »

Obviously that's possible, and many applications do that, but I always wonder why. Personally, I find that is an ineffective way to paginate, since in most circumstances a user wants to either go from one page to the next or previous, or they want to go to some other random place in the middle, which this practice doesn't allow. I think your solution depends on the kind of data you are displaying and how it is likely to be used. Sometimes there's another search value that can be used, or if not, I think I would show something like:

Code: Select all

<< Prev   *    page |__| of 500  *   Next >>
and let the user specify a page number.
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: Pagination for big sql table results

Post by Sindarin »

I'll probably add something like that as well, but I don't want the page numbers to mess with the layout.
Post Reply