On Wed, Aug 08, 2001 at 09:27:34AM +0930, Daniel Falkenberg wrote:
> Now what I really want to be able to do is only display 10 of the rows in
> the database then create a hyperlink to to the next 10 and so on.

Pass along an offset with each request, and structure your SQL query to
use this offset as a starting point.  For example, with mysql you'd say
something like:

    SELECT * FROM table LIMIT $offset, 10;

This will give you at most 10 rows, starting at $offset.  When you output
the HTML put $offset + 10 in a hidden field, or in the query parameters for
the "next" link.  This also gives you the ability for a "previous" button or
link, by passing in $offset - 10.

I'll leave edge case checking (such as when you get back less than 10 rows,
indicating you're at the end) for the reader.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to