Re: multiple pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The simplest way is to use the LIMIT keyword in your SQL statement. Set, or
allow the user to set, the number of items to show at one time, then keep
this number as a hidden field and use it to determine what record to go to
when they click the page number or the next button. So a sample would look
like:

$NumOfRecs = 30; // or any value that the user might choose or whatever you
want
$start = ($PageToDisplay * $NumOfRecs) - $NumOfRecs;
SQLtext = "select blah blah blah from mytable limit $start, $NumOfRecs";
{ get the data and display the page}

with this method there is no management except to keep track of the current
page and the number of records to display. This can be done with hidden form
fields or any other way you choose (cookies, global vars, etc).

Hope this helps.

Jim
 
-------Original Message-------
 
From: Serguei FRAMPOL
Date: Wednesday, January 08, 2003 11:51:31 AM
To: php-db@lists.php.net
Subject:  multiple pages
 
Hello everybody,

I am PHP-beginner, and I have to code the multiple result pages
management - just like search engines display something like that:

<<First <Previous 1 2 3 4 .... Next> Last>>

io each page allowing users to link to a dozen neighboring pages directly.
Could you give me some tips of how to code this kind of management?

Thank you in advance.

-- 
Best regards,
Serguei mailto:serguei@frampol.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

. 

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux