SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast Locker's Avatar
    Join Date
    May 2005
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Previous/Next in a PHP gallery?

    Hey,

    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

  2. #2
    SitePoint Enthusiast Locker's Avatar
    Join Date
    May 2005
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •