I'd like to query my database and ask it for an array of photo ids belonging to a user and order it by time desc. Then from that array i would like to select the photo one up or one down from the current photo. i was thinking i could then search the array by the value after the => select the number in the []. i tried attaching a photo but i'm not sure if it uploaded. Anyway what i want to do is create a url with id of the next photo and one with the previous photo id in it, so i can have next and previous buttons for my photos.
A sloppy (and slow) solution, can't think of a better way atm $currentpic = ??; $number = -1; for($k = 0; $k < count($array); $k++) { if($array[$k] == $currentpic) { $number = $k; break; } } if($number == -1) { echo 'image 404'; } PHP: