Jump to content


This topic is now archived and is closed to further replies.


Image Rotator

Recommended Posts

My head is spinning with all the image rotating codes I have seen on various sites, yet none seem to do what I am looking for.
I am looking for something like here (found it through another msg board on coding issues) http://www.chickenbucket.com/e107/page.php?7
Where on a sidebar they have a random thumbnail.  When a visitor wants to see it bigger they can click on it and it will take them to a bigger view (they use a gallery, I dont want/need a gallery style...just an image)

It is the last part I need to figure out before I can move from test to implementation (hopefully)
So basically I want a random thumbnail to show up with a link to something like http: //laxnation.com/home/displaypic.php?picid=14
thumbnail 14 links to full image 14, thumbnail 1 links to full image 1.

Share this post

Link to post
Share on other sites
This worked for me. It will display a random pic everytime the page is refreshed
$sql = mysql_query("SELECTphoto_id FROM photos ORDER BY rand() LIMIT 1") or die (mysql_error());
while($info = mysql_fetch_array( $sql ))


$data = mysql_query("SELECT * FROM photos WHERE photo_id='$photo_id'")
or die(mysql_error());
while($info = mysql_fetch_array( $data ))

Print "<td><a href='http://www.yoursite.com/displaypic?picid=$photo_id";
Print "&sid=$sid' target='_self'>";

Print "<img src='$photo_source' height='75' width='75'>";


It pulls a random photo id from the database and then performs a query on that id pulling out the image source and displays a link with that id.

Hope this helps


Share this post

Link to post
Share on other sites


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.