Forum Moderators: open

Message Too Old, No Replies

Resetting a mysql row at the beginning of every month

         

Seamless

8:41 am on Jan 6, 2006 (gmt 0)

10+ Year Member



I wonder if anyone can help me....

I have a website written in php and wish to reset a row (in this case 'hits_out') at the beginning of every month. I know i can do it via a cron job but i would like to include a file that checks the date on my homepage.

Any ideas?

Thanks in advance

Seamless

Nutter

3:48 pm on Jan 9, 2006 (gmt 0)

10+ Year Member



If you know how to do it via cron, why not just write a short php script to do it and include() it in your homepage?

Something like (if todayisthefirst) { run whatever sql you need to to reset ; }

Although, why don't you want to do it via cron? It seems a simpler process. Plus, you wouldn't have to run code for it every time someone visits your page. Plus, what happens if nobody visits you on the first?