how can i page mysql selected records? for example, i want each page to have only 10 records.
Announcement
Collapse
No announcement yet.
How to page records?
Collapse
X
-
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?PHP Code:header('HTTP/1.1 420 Enhance Your Calm');
-
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...pagination.htm
Its a simple example of pagination. Start easy, work up to complex
Edit:
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:
PHP Code:if (!isset($_GET['pagenum']))
{
$pagenum = 1;
}
else
{
$pagenum = (int)$_GET['pagenum'];
}
Last edited by Fou-Lu; Apr 10, 2009, 12:22 AM.PHP Code:header('HTTP/1.1 420 Enhance Your Calm');
Comment
Comment