RE: [PHP] Prev/Next
| From: | Maxim Maletsky | Date: | Mon, 16 Oct 2000 06:31:05 +0000 |
| Subject: | RE: [PHP] Prev/Next | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20306@lists.php.net to get a copy of this message | ||
If you select " LIMIT 0,10" in your query it will pull out results from 0 to
ten.
then if you select " LIMIT 10,20" it would skip the first 10 and go from
11-th to 20-th.
you pass the variable via get and with few mathematic calculations generate
the query and what to print at the bottom.
at the bottom if (there was a limit var in get) then print "back link" since
without a query it's only forward, then if (the cont you would have to do
without limiting (before the actual connection) is higher then what is
limited now to), then put the "forward link" ... etc..
confusing?
It's hard to give you MY code since it probably won't work for you and would
just confuse your thoughts.
Just build it basing on what I wrote here.
Believe me, it is simple, but, confusing...
-----Original Message-----
From: Website4S@aol.com [mailto:Website4S@aol.com]
Sent: Monday, October 16, 2000 2:56 PM
To: php-general@lists.php.net
Subject: [PHP] Prev/Next
Hi,
I have been searching threads and web sites for help with setting a display
limit and prev/next buttons but I am getting no where. The code I have found
I can`t get to work :/ Does anyone on the list have any suggestions for
adding a limit of 20 results per page and adding the prev/next buttons to
the
bottom for the following code ?
<TABLE BORDER="1"
WIDTH="2000"><tr><TH>Delete_User</TH></TR>
<?php
$host="localhost";
$user="";
$passwd="";
$dbase="";
$Selstmt = "SELECT * FROM Member order by Surname";
$dbh=mysql_connect($host, $user, $passwd);
$query=mysql_db_query($dbase, $Selstmt);
$num_rows=mysql_num_rows($query);
for ($i=0; $i<$num_rows; $i++)
{
mysql_data_seek($query, $i);
$array=mysql_fetch_array($query);
printf("<tr><td>%s</td><td>%s</td></tr>",
$array["Surname"]);
}
mysql_close();
?>
</TABLE>
Thanks in advance for any help.
Ade
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net