On Wednesday 19 December 2001 16:28, you wrote:

yea that's easy :-)
first I have to tell you that the first result is numbered 0 like in arrays 
ok?
now you would do a select like this
select * from table limit 10;
this will give you the first 10 results since you didn't supply a start 
number after that you want the second 10 ofcourse so then you do
select * from table limit 10,10;
10 is actually the 11th result starting from there you'll get 11 through 20
select * from table limit 20, 10;
will give you 21 through 30 etc etc
ofcourse in PHP it would be easier to supply the first rule as
select * from table limit 0, 10;
since you then don't have to check whether it's the first so it'll save ya a 
loop or an if statement.

proof of concept:
mysql> select * from test;
+------+
| bla  |
+------+
|    1 |
|    2 |
|    3 |
|    4 |
|    5 |
|    6 |
|    7 |
|    8 |
|    9 |
|   10 |
|   11 |
|   12 |
+------+
mysql> select * from test limit 0,3;
+------+
| bla  |
+------+
|    1 |
|    2 |
|    3 |
+------+

mysql> select * from test limit 3,3;
+------+
| bla  |
+------+
|    4 |
|    5 |
|    6 |
+------+

mysql> select * from test limit 6,3;
+------+
| bla  |
+------+
|    7 |
|    8 |
|    9 |
+------+


hope that helps

> Silly question,
>
> Does anyone have a quick example of how you would show X numbers of
> database records at a time from a query?  (you know, list 25 of 400 records
> with  next/previous navigation)...
>
>
> Thanks
>
> Kelly

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to