Jump to content


Image Rotator

  • Please log in to reply
1 reply to this topic

#1 Stegs

  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 14 September 2006 - 01:54 AM

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.chickenbu...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.

#2 skatermike21988

  • Members
  • PipPipPip
  • Advanced Member
  • 100 posts
  • LocationFlorida

Posted 14 September 2006 - 06:29 AM

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


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users