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 Answer 1

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

Sign up to request clarification or add additional context in comments.

5 Comments

Yeah, but i've not specified that i'm not using Linux, actually this is designed for Windows/Wamp
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..
it depends what your needs are, you can take a look at this gearman.org/use_cases and read about Gearman.
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
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 (stackoverflow.com/questions/1981036/…)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.