1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to make a mysql query auto-run every week?

Discussion in 'PHP' started by Istvan, May 23, 2008.

  1. #1
    Hi DPers, I would like to know how in PHP is possible to make something autorun every n time (everyday/every 7 days for example).

    What I have to do is to run this mysql query every 7 days:
    UPDATE table SET published=1 WHERE date <= CURDATE()
    Code (markup):
    so I can upload many files to the server in advanced and show it (publish) only when the date in the table is equal to today date.

    Please give me detailled instructions as I'm not an expert. I think this is not so difficult.

    Thanks :)
     
    Istvan, May 23, 2008 IP
  2. vtida.com

    vtida.com Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you can use cron to run it
     
    vtida.com, May 23, 2008 IP
  3. madmax728

    madmax728 Banned

    Messages:
    620
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Here follow these steps:
    Go to your hosting Cpanel
    There you will find something like Cron Jobs or Cron, select that
    There it will ask for the time interval and location of the php file, give the required data.
    Thats all!
     
    madmax728, May 23, 2008 IP
  4. Istvan

    Istvan Well-Known Member

    Messages:
    1,543
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    175
    #4
    I had used Cron Jobs in the past with another script but it wasn't working (probably due to a problem in the script file)

    Meanwhile I try with this file, is there an alternative method without Cron Jobs?
     
    Istvan, May 23, 2008 IP
  5. anwaraa

    anwaraa Active Member

    Messages:
    167
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    90
    Digital Goods:
    2
    #5
    Is there a page on your site that is always accessed by a site visitor at least once a day but must be everyday?
     
    anwaraa, May 23, 2008 IP
  6. Istvan

    Istvan Well-Known Member

    Messages:
    1,543
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    175
    #6
    The homepage is visited everyday, but I thought there was a function to make it to set it to run every "n" time.
     
    Istvan, May 23, 2008 IP
  7. madmax728

    madmax728 Banned

    Messages:
    620
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I can make a program which opens the page when your computer is on. You can set it to do at a particular time by using schedule task.
     
    madmax728, May 23, 2008 IP
  8. kasapa

    kasapa Peon

    Messages:
    86
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    you can write triggers

    please look at

    hxxp://dev.mysql.com/doc/refman/5.0/en/triggers.html
     
    kasapa, May 23, 2008 IP