OK, that's perfectly do-able.  It still just seems like a lot of database
hits, however.  (Not that I'm arguing.  ;)  My approach had definitely been
"do-this-to-the-results-I-already-got" and not
"get-the-results-this-particular-way".  Must remember to think outside my
self-defined box.

Thank you!
jen

> -----Original Message-----
> From: Julie Meloni [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 30, 2002 9:04 PM
> To: Jen Swofford
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] display 4 at a time
>
>
> JS> What I'm trying to do is have the ability to page through the
> database just
> JS> 4 products at a time.
>
> Use the LIMIT clause in your SQL query:
>
> select * FROM products WHERE prod_cat = $cat_ID LIMIT 4
>
> For the paging, you would use LIMIT with an offset (starting
> point) and number of rows, like:
>
> page 1:
> select * FROM products WHERE prod_cat = $cat_ID LIMIT 0,4
> page 2:
> select * FROM products WHERE prod_cat = $cat_ID LIMIT 4,4
> page 3:
> select * FROM products WHERE prod_cat = $cat_ID LIMIT 8,4
>
> and so on.
>
> Your links could send the offset as part of the query string, so you
> just re-run the script and offset is dynamic.
>
>
> - Julie
>
> --> Julie Meloni
> --> [EMAIL PROTECTED]
> --> www.thickbook.com
>
> Find "Sams Teach Yourself MySQL in 24 Hours" at
> http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to