RE: [PHP] mysql LIMIT
| From: | David Freeman | Date: | Sun, 14 Jul 2002 21:42:13 +0000 |
| Subject: | RE: [PHP] mysql LIMIT | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-107640@lists.php.net to get a copy of this message | ||
> can I use limit to show the 2nd record on without knowing
> how many more records there might be?
>
> also, what happens if I set the limit in a mysql statement
> (LIMIT 5,10), but there are only 3 results? 7 results?
My answer would tend to be that you should try it for yourself and
see...
But anyway, without having tried it myself recently, the first question
is that you could use LIMIT (2, 1) and you'd probably get what you're
trying for. As for the second question, you'll only get what records
there are. If your limit excludes all possible results then you'll get
no result (ie. If you use LIMIT(5, 10) and you've only got 3 records,
then you won't get anything back at all. If you've got 7 records then
you'll get the last 3 of them). But in all honesty, you could have
worked this out for yourself fairly quickly with some simple testing of
your own.
CYA, Dave