well, establish how many you want per page ($perpage = 25).
so your first limit will obviously be 0 and 25.
since the offset is 0, there is no back button page 1, and the forward
button is something like view.php?offset=25.
then on subsequent pages, you use the $offset and $perpage to create the
LIMIT statement. the links are created by taking the $offset (currently 25)
and minusing/adding the $perpage figure.
<A HREF="view.php?offset=<? echo $offest - $perpage; ?>">back</a>
<A HREF="view.php?offset=<? echo $offest + $perpage; ?>">forward</a>
Then you only have to watch out to make sure that the forward button isn't
there on the last page of results.
It's hard to explain, easy to implement. Just sit down and think it
on 27/06/02 5:55 PM, Aqua ([EMAIL PROTECTED]) wrote:
> The LIMIT function is working, thanks. But how to generate back / forward
> links using html/php? Thanks for your help.
> ----- Original Message -----
> From: Justin French <[EMAIL PROTECTED]>
> To: Aqua <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Thursday, June 27, 2002 1:56 PM
> Subject: Re: [PHP] Display Records in Multiple Pages
>> Use the LIMIT function in your SELECT query... check out the MySQL
>> and then generate back / forward links depending on your current offset.
>> should be expandable to 1000 records without any mods to the code.
>> Justin French
>> on 27/06/02 4:54 PM, Aqua ([EMAIL PROTECTED]) wrote:
>>> I have 100 records in mySQL database and I need to display them in my
> web page
>>> using php and html. How to display them in multiple pages? Each page
>>> contain 25 records. Does anyone know how to do it other than create 4
>>> and manually list the records there? or maybe point me some reference
>>> Your help will be much appreciated. Thanks!
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php