
January 19th, 2000, 06:05 PM
|
|
Contributing User
|
|
Join Date: Oct 1999
Location: Annapolis, Maryland US
Posts: 113
Time spent in forums: < 1 sec
Reputation Power: 14
|
|
|
One possible way is to execute the query and use mysql_affected_rows ($retrieved=mysql_affected_rows($link)) to see how many rows were returned from it. Then use MySQL's limit in the query for each successive page.
If 144 rows were returned from the original query and this is stored in the $retrieved variable....
$increment=20;
if(empty($currval)) // this is the first query
{
$currval=0;
$query="select * from table limit $increment";
}
else // all subsequent queries
{
$currval+=20;
$query="select * from table limit $currval, $increment";
}
.
.
.
query output
.
.
.
if($currval < $retrieved)
{
print"<a href="search.php3?currval=$currval&retrieved=$retrieved">See next results</a>";
}
...limit 20 will give you the first 20 rows returned from query
...limit 20, 20 will return twenty rows starting with the 21st row
...limit 40, 20 will give 41 through 60 and so on
This is rough codestimate, but it may be able to help
|