TomFromKWD Posted May 11, 2011 Share Posted May 11, 2011 Hey guys I have a client who wants to upload images then have them display on his page... obviously that process is not an issue at all. The catch is he wants the image to change at midnight and display the next image in the sequence, then display it until midnight strikes, and then the next in the sequence is displayed. Is there any code type that will recognise a set time/date and display coressponding images in a database? I realise I made need to add a field for an ID number/date ID for the code to identify which image to display, but not sure what code will/wont work Can some one point me in the right direction would be much appreciated Thanks Tom Link to comment https://forums.phpfreaks.com/topic/236098-code-to-display-certain-data-and-certain-times/ Share on other sites More sharing options...
sunfighter Posted May 14, 2011 Share Posted May 14, 2011 Cron is on every server. It runs your programs at a specific time or date. Setting up a cron job to do this should be fairly easy to grasp. Link to comment https://forums.phpfreaks.com/topic/236098-code-to-display-certain-data-and-certain-times/#findComment-1215404 Share on other sites More sharing options...
TomFromKWD Posted May 20, 2011 Author Share Posted May 20, 2011 thankyou kindly. I shall go read up Link to comment https://forums.phpfreaks.com/topic/236098-code-to-display-certain-data-and-certain-times/#findComment-1217944 Share on other sites More sharing options...
dragon_sa Posted May 20, 2011 Share Posted May 20, 2011 This can be done without a cron job, somethings to take into consideration is sequence order of images, if the client uploads the images in the order they want them displayed then this is fairly easy to handle, you simply add a timestamp field or rename the images to the timestamp of the time you want them to finish each day on upload to the server. Then just have your script on the page that displays the image work out which image to display based on the current timestamp when page is loaded and the timestamp of the image that is due to expire before that with its end time stamp. If the user uploads the images randomly then you will need to implement an ordering feature to shuffle the images and the timestamps around. Link to comment https://forums.phpfreaks.com/topic/236098-code-to-display-certain-data-and-certain-times/#findComment-1217998 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.