stanleybb Posted March 7, 2008 Share Posted March 7, 2008 Anybody know if you can have php code that retrieves a picture off the database, but it can be randomizes, so each time you go on that bit a different picture is displayed, if so how would you do this? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted March 7, 2008 Share Posted March 7, 2008 <?php // Get all images $query = mysql_query("SELECT * FROM table_images ORDER BY rand()"); $row = mysql_fetch_array($query); echo '<img src = "'.$row['image_root'].'">'; ?> Quote Link to comment Share on other sites More sharing options...
stanleybb Posted March 7, 2008 Author Share Posted March 7, 2008 Sorry i meant its ina folder called upload on ftp. how woulld you retrieve just one of them and put them in randomly Quote Link to comment Share on other sites More sharing options...
phpSensei Posted March 7, 2008 Share Posted March 7, 2008 I won't wrtie the script for you, but here is a scrip you can download http://www.webcreationz.co.uk/random-file-picker.php Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted March 8, 2008 Share Posted March 8, 2008 I use this one: http://www.alistapart.com/articles/randomizer/ Works perfectly! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.