BoarderLine Posted December 16, 2008 Share Posted December 16, 2008 Hi All, I am not entirely familiar with php and am trying to display an image on my site from a recordset which will reload every several seconds with a fixed(set) image. Example: Random image from rs (time delay) set image (time delay) Random image from rs etc.. Currently I have the following code that is working well for displaying a random image however I want to change 2 things with it 1) as it is it only alternates on page refresh, so how would i make it alternate every several seconds? 2) How would I make it reload to a set image and alternate with an image from the database? SELECT ImageFile rand() as random_number FROM clublistingpics ORDER BY random_number DESC LIMIT 1 Thanks to anyone that can offer advise with this. Link to comment https://forums.phpfreaks.com/topic/137146-cycle-fixed-image-with-random-image/ Share on other sites More sharing options...
mmarif4u Posted December 16, 2008 Share Posted December 16, 2008 rand() will work, but you have to refresh your page through javascript or meta tag. OR better option ajax. EDIT: rand() will look like: SELECT * FROM table ORDER BY RAND() Link to comment https://forums.phpfreaks.com/topic/137146-cycle-fixed-image-with-random-image/#findComment-716428 Share on other sites More sharing options...
BoarderLine Posted December 16, 2008 Author Share Posted December 16, 2008 Thanks mmarif4u i will look into that, how about alternating the random image with a set one? Link to comment https://forums.phpfreaks.com/topic/137146-cycle-fixed-image-with-random-image/#findComment-716433 Share on other sites More sharing options...
xtopolis Posted December 16, 2008 Share Posted December 16, 2008 Are the images stored in MySQL or in a file folder? If they're in a file folder it would be easy to glob them and then rand() that... I get scared with MySQL randoms if the tables are large.. Link to comment https://forums.phpfreaks.com/topic/137146-cycle-fixed-image-with-random-image/#findComment-716444 Share on other sites More sharing options...
BoarderLine Posted December 16, 2008 Author Share Posted December 16, 2008 Thanks - Yeah they are with MySQL unfortunately Link to comment https://forums.phpfreaks.com/topic/137146-cycle-fixed-image-with-random-image/#findComment-716449 Share on other sites More sharing options...
xtopolis Posted December 16, 2008 Share Posted December 16, 2008 Then just in case, I point you to this thread: http://www.phpfreaks.com/forums/index.php/topic,125759.0.html Link to comment https://forums.phpfreaks.com/topic/137146-cycle-fixed-image-with-random-image/#findComment-716457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.