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? Link to comment https://forums.phpfreaks.com/topic/94949-random-pictures/ 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'].'">'; ?> Link to comment https://forums.phpfreaks.com/topic/94949-random-pictures/#findComment-486367 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 Link to comment https://forums.phpfreaks.com/topic/94949-random-pictures/#findComment-486378 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 Link to comment https://forums.phpfreaks.com/topic/94949-random-pictures/#findComment-486383 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! Link to comment https://forums.phpfreaks.com/topic/94949-random-pictures/#findComment-486732 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.