Results 1 to 2 of 2
Thread: Previous/Next in a PHP gallery?
Nov 13, 2007, 09:47 #1
Previous/Next in a PHP gallery?
I'm in the middle of my first attempt at making a very simple gallery with PHP/MySQL. I have thee tables... img, cat and img_cat. The img table includes all of the image detail (id, name, description, fileurl) and the cat table includes all of the cat detail (id, name, description). The img_cat table links them together (id, imgid, catid).
My question is, how can I add dynamic previous/next links into my gallery? Images are loaded up via img.php?id=[image id here]. How can PHP find out if there's an image id smaller than the current image id within a specific category?
Basically... what's the best way of doing it? Any help would be greatly appreciated
Nov 13, 2007, 09:58 #2
Sorry guys, it's okay now!
Clearly wasn't thinking! All I needed was a simple query to check for id's less than the current and then use mysql_num_rows to sort the rest.
Feel free to close/delete