having a little bit of mysql/php woes...
--the quick version--
what im thinking is i need a way to determine what record number or row in the table a perticular "id" is on and then to select the adjacent rows based on this information.
--the longer version--
im building a photo site based around a mysql database and when any given photo is displayed im trying to display thumbnails of the previous and next photos in the table. i want all of the photos to have their own perminent url derived from their auto-incrementing "id" in the mysql table so that even if photos get deleted the url would stay the same. only problem is i cant figure out how to retrieve the photo data from the previous and next records in the table when i search for a specific photo by its "id".
heres a snippet of what im looking at:
id - name - description
----| ----------| ------------
4 | fun.jpg | i am having fun
6 | tom.jpg | tom is makin burgers
10 | alf.jpg | alf is alf
say the url is like index.php?picID=10. i have no problem retrieving picture id=10 and displaing all its info, but since i have no idea what row in the table it is on i cant tell mysql to return the previous and next picture data for dislpay.
thanks so much in advance for any help or comments that may come.
-greg
Edited by greggreg, 21 January 2006 - 04:33 PM.
