|
Posted by Jon on 09/21/05 19:51
Hello,
I'm currently working on a photo gallery project that is requiring quite a
bit of PHP/mySQL and am having trouble. Right now, I have a program that is
bringing in records from the DB, and using a 'next' button to cycle through
those records. Currently, the record I'm obtaining is running off of an
incrementing variable (nextImage) . I'm able to increment the nextImage
variable, and link through each record in the DB while moving to the next
using one link on the page.
The problem - I now need to have the recordset I'm grabbing from the DB be
based off of a Category ID - Each image has a catID associated with it (in
the same table as a FK). My problem is that as I'm incrementing the
nextImage variable by 1 each time which is used to call the next photoID,
the query fails when I reach a photoID with a catID that's not specified.
My question is: How can I cycle through a recordset of data from the DB,
without knowing what the next ID will be? Right now, I can say "SELECT *
FROM table WHERE catID = $variable" - however, I need to move through each
record in this query via an HTML link - so when the user clicks 'Next', it
needs to not go to 'currentImage + 1' for example, but it needs to move to
the actual next value in our recordset.
Any help is appreciated, thank you in advance.
[Back to original message]
|