if (!isset($startlimit)) {
$startlimit = 0;
}
$endlimit = $startlimit + 10;
$yourquery = "your query data LIMIT $startlimit, $endlimit"
that should give you enough insight on how to work it.
Chad
-----Original Message-----
From: Daniel Page [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 07, 2003 3:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Limit the amount of returns in a MySQL query
Hi All,
Imagine I have a giant database table tracking email addresses (I don't but
it is the first example that jumps to mind after my recent antispam
campaign!).
If i do a
select * from mailaddresses;
I will get all of the table.
If i do a
select * from mailaddresses where id < 10;
I will get all the records where the id is less than 10...
The problem is that I want 10 records, period, so if id is not a primary
key, I could have 60 records that match... or if it is a P.K., but I delete
2 to 8, it will only return 2 records (1 and 9...)
How can I structure the query to only return only 10 records ? the idea
being able to construct a query where if there are more than 10 (or x)
results on a page, you click on a link 'page 2' and so on, and the next
query will return the next 10 (or x) records...
Cheers,
Daniel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php