Forum Moderators: coopster

Message Too Old, No Replies

Another Question

         

MarcoPolo

4:38 am on Mar 29, 2005 (gmt 0)

10+ Year Member



I've got a query that returns 100 rows.

On my HTML I want to start at row 'x' and show a total of 'y' rows.

I can specify the starting row and total to display through a URL and use GET to, well, get them.

But I'm not finding how to specify in a query to show rows 5-15, or 10-20, 35-45.

Any ideas?

Thanks in advance!

ironik

5:00 am on Mar 29, 2005 (gmt 0)

10+ Year Member



If you are using a mysql database it supports a LIMIT clause:

SELECT * FROM mytable WHERE something='something' LIMIT 10, 10;

That query will return 10 rows, offset by 10. So if you had 100 rows it would return the rows 10-20. You can use your imagination to get what you want out of it. Different databases have different methods of returning an offset/limit, so this is only valid for MySQL as far as I know (and maybe postgresql).

MarcoPolo

6:00 am on Mar 29, 2005 (gmt 0)

10+ Year Member



Excellent! Thank you very much!