0

I want to organize some kinds of actions in different periods of time, for example i want to make some UPDATES in certain days (the end of the month, the beginning of the next month, one specific day at one specific hour)...

In my example i have to follow some records that have int variable and i want to turn their values to 0 ad a certain time.

I've tried to use the sleep function but it loops over and over and i think this is not a usable solution...

Any solution?

Thanks

1 Answers1

2

You probably need to read about cronjob, the below link should resolve your problem:

http://www.thegeekstuff.com/2011/07/php-cron-job/

This is an interesting link as well : http://net.tutsplus.com/tutorials/php/managing-cron-jobs-with-php-2/

in case you are using windows you can take a look at this : Use php to set cron jobs in Windows

Community
  • 1
  • 1
Mehdi Karamosly
  • 5,388
  • 2
  • 32
  • 50
  • Yeah, but i've not specified that i'm not using Linux, actually this is designed for Windows/Wamp – Alessandro Violante Jun 10 '13 at 21:09
  • Thanks man, but is this the only way? Running external scripts? Or is there a way to do, like a setInterval or something like this to run something every 20 or 30 days? I could make a button to run the statement, but if someone goes on and click i'll lose everything.. – Alessandro Violante Jun 10 '13 at 21:17
  • it depends what your needs are, you can take a look at this http://gearman.org/use_cases and read about Gearman. – Mehdi Karamosly Jun 10 '13 at 21:27
  • my needs are the following: on the 25 of the month make me a select and print. on the end of the month raise some records to int 0 – Alessandro Violante Jun 10 '13 at 21:30
  • I think cron/task schedular (for windows) is the best way, you can add a checking on your server side, but what if no one visit your webpages on those dates, then your updates won't be done, so I suggest that you use cron/task schedular (http://stackoverflow.com/questions/1981036/php-script-to-execute-at-certain-times) – Mehdi Karamosly Jun 10 '13 at 21:38