View Full Version : How to page records?
04-10-2009, 05:17 AM
how can i page mysql selected records? for example, i want each page to have only 10 records.
04-10-2009, 06:02 AM
Pagination is language dependant. MySQL has the advantage of a LIMIT clause, but by itself its pointless (for pagination purposes). What language are you developing in?
04-10-2009, 06:08 AM
What language are you developing in?
04-10-2009, 06:20 AM
I have a PHP5 pagination class posted in the snippets. Its somewhat advanced and assumes that whomever is incoporating it is familiar with callback routines and data handling.
Pagination is a rather simple process, but does require calculations in order to determine where to draw from and how far to go (recordcount wise). For this reason, it is really easy to get lost.
Here is a pretty good link I found on about: http://php.about.com/od/phpwithmysql/ss/php_pagination.htm
Its a simple example of pagination. Start easy, work up to complex ;)
Actually, I lied thats not a very good example. It makes use of long past deprecated features like register_globals.
Specifically, the $pagenum doesn't exist, it should be in an if/else:
$pagenum = 1;
$pagenum = (int)$_GET['pagenum'];
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.