Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update content every 24 hours

Status
Not open for further replies.

crighton

Programmer
Aug 31, 2001
7
ES
Hi,

I'm looking for some basic guidance on the best method to automate the following task:

1) Pull some basic data / image from a database.
2) 24 hours later go back to database and redo the above to replace current content with new content.

I've looked around and can't find scripts close enough to the above for me to work out the best way to approach it. I know it involves two basic concepts:

1) Some sort of date / time comparison to control the 24hr update sequence (no date or timestamp is included in the Db table to be used).
2) Some way to randomly pick replacement content from the Db by id number.

Any suggestions or script samples are welcome. Not looking for any finished scripting here just pointers / samples on how best to approach it.

Many thanks,

Gary Crighton
 
This being the PHP forum, I'd recommend that you use a PHP binary instance (not compiled for Apache as a module, but as a standalone) and then launch it with cron every 24 hours at whatever time of day you want.

PHP has a ton of different ways to choose a random number, which have been flogged heavily at
Many databases even have a random number or random selection functionality, so you might be able to get a somewhat random result from a query if you ask your db server nicely.

HTH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top