[eluser]jedd[/eluser]
You're too kind.
[quote author="megabyte" date="1260692805"]
The next photo will have an offset of 1, then 2, then 3. So you just need to use an offset and limit in your db query, and use the url to store the current offset.[/quote]
I gather the problem here is because Jamie revealed <sic> this:
[quote author="Jamie B" date="1260684904"]
Obviously all of the photos will not have IDs that are a number below/above the current, so it is not as easy as adding or subtracting 1 from the current ID to move around in the album.
[/quote]
Obviously the problem is that what is obvious to Jamie, who has the schema, the application design, etc in front of him and in his head - is not necessarily obvious to those of us who are not Jamie.
Why you can't find the next number by adding one to the current number is indeed a mystery at the moment. Until that's explained it's hard to come up with an algorithm that provides the same effect.
FWIW I only popped in here because I already have a solution to a comparable problem. My situation is probably slightly different - I have a set of photo information that is pulled into my app on every page load as two similar-looking arrays. The primary key in the array is an image ID, which is a 10-character hex string - this makes some things easier, but means I can't easily do next/prev just by changing an index (array key) value. The two arrays are a full set of all images, and a subset of images. The subset is determined by zero or more filters. Filters apply to tags. A photo can have zero or more tags. Users can nominate zero or more filters. I need to display a set of x (default 8) thumbnails that surround the current photo, and provide next/prev button for the current photo. Clearly it's not rocket science, but there's a couple of patterns you could apply here. I'm happy with my way (despite it not being hugely elegant) because it's a low-load site on a reasonably powerful server, I'll likely never have more than a couple of thousand images being tracked, my relevant data is always available in memory (rather than having to be ascertained from IO calls).