Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2002

    Unanswered: Update content every 24 hours


    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

  2. #2
    Join Date
    Nov 2002
    Hi Gary,

    I would break your problem into three pieces:

    "Refresh" application - sequentially reads your "old" database, randomly accesses the "new" database and copies the contents from "new" to "old".

    "Maintenance" application - allows you to add or remove a record from the "old" database.

    Windows Task Scheduler to execute the "refresh" application during "off-peak" hours.

    Good Luck,
    Bruce Baasch

  3. #3
    Join Date
    Dec 2002

    How's this progressing?

    Can you give a little more info? I'd like to help but need more info.

    If you're on a *nix system you can just enter a job in your crontab to run at the same time every day to call your PHP script. I'm not sure if this is completely applicable, but if I just wanted to update an image every day, say for something like an image of the day script I'd just have the list of files in a database with a timestamp and in my script check for the specific timestamp you want and have the cron job run every night. If you know just want the latest file you can bypass the whole database thing and have your script simply search the files in a directory and check their file properties for when they were last updated.

    Can you go into more specific details about what type of help you need?
    Hope this helps,

  4. #4
    Join Date
    Sep 2002
    Kyiv, Ukraine
    cronjob is the thing you need if you are using *NIX hosting solution. Simply create some simple script to change link in the HTML file for the current, say 'image of the day' source file, chmod it to 755 and put in cornjobs as a task to cpmplete once per day.

    Very easy to implement, nothing guru-like in this task, so don't be afraid to get in this a bit deeper.

    P.S.: Task-sheduler should do the same thing as well for Windows systems. But I personally never tried it myself, so can't say for sure if it works fine. It should anyway.
    Yours faithfully,
    Yaroslav Zaremba

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts