PHP/MYSQL - User Photos Prev/Next link
===

My project has User accounts which has Photos that belong to each User that has uploaded them

Id like to show a next and previous photo for each user, so when I go to a friends list of photos I can navigate (Obviously) to the users next uploaded photo. I would be fine with these being the next/previous photo in photo_id order.

How would you write that kind of query for one next / previous photo?

My table structure is like so.

    CREATE TABLE IF NOT EXISTS `userphotos` (
      `photo_id` int(11) NOT NULL auto_increment,
      `photo_ownerid` int(11) NOT NULL,
      `photo_ispublic` int(11) NOT NULL,
      `photo_name` varchar(100) NOT NULL,
      `photo_caption` varchar(100) NOT NULL,
      `photo_imagedata` longblob NOT NULL,
      `album_id` int(11) NOT NULL,
      PRIMARY KEY  (`photo_id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=89 ;

