Jump to content

Image slideshow woes...


ching-a-ling

Recommended Posts

Hello everybody!

Ok, here is my problem. I want to make a slideshow sort of page, where a user clicks on a thumbnail from a photo gallery and a window pops up that shows the image and "next" and "previous" buttons. I am having so much trouble with this! The image data is stored in a database, and the problem is that I can't figure out how to load the two images that are [i]nearby[/i] the current image. The code I have so far is below. Thank you so much!



[code]
    $current_pic = mysql_query("SELECT image_path FROM pictures WHERE id = '$id'");
    $pix = mysql_query("SELECT id FROM pictures WHERE category1 = '$cat' OR category2 = '$cat' OR category3 = '$cat' AND id != '$id'");
    $img = mysql_result($current_pic, 0);
    $next = mysql_result($pix, 0);
?>
[/code]


<? if($prev){ echo "<a href=\"$PHP_SELF?id=$prev&cat=$cat \"><img src=\"previous.gif\" border=\"0\"></a>"; } ?>
<a href="<? echo "$PHP_SELF?id=$next&prev=$id&cat=$cat"; ?>"><img src="next.gif" border="0"></a>
</div>

</body>
</html>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.