RE: [PHP] selcet statement question
| From: | Jay Blanchard | Date: | Fri, 26 Jul 2002 13:03:08 +0000 |
| Subject: | RE: [PHP] selcet statement question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109710@lists.php.net to get a copy of this message | ||
[snip]
I know that i can retrieve records 1-24 in my db with a select statement
like SELECT whatever FROM tablename ORDER BY id ASC LIMIT 23, but how can I
get records 25 to 50 if I have 100 records in my DB?
[/snip]
Different DB's have differing ways of doing this, like MySQL;
SELECT *
FROM foo
ORDER BY id ASC
LIMIT 0, 24 ****** first 25 records
SELECT *
FROM foo
ORDER BY id ASC
LIMIT 25, 24 ***** next 25 records
Don't forget that the row numbering starts with 0.
HTH!
Jay
"Oh, sure
but whats the speed of DARK?"
*************************************
* Want to meet other PHP developers *
* in your area? Check out: *
* http://php.meetup.com/ *
* No developer is an island ... *
*************************************