Resetting record on month end/start
Posted: Wed Apr 09, 2008 3:39 pm
I am working on a PHP application. It involves a database table which maintains some candidates and user votes for each of them. Now what I want is at the end of each month or starting of the month, I want the "votes" field in the table to be reseted to zero (0). Now, I am not able to decide how to achieve this. Should I write a php script on the homepage to check if the current day is 1st day of the month. If yes, then I can reset the votes else leave it. The downside of this logic is what if the site is not opened on the 1st day of the month at all, though it is a near impossible case. Can there be a better approach to solve this issue?
Thanks.
Thanks.