Jump to content

Mysql Daily Action


23.12.2012

Recommended Posts

I'm working on this application, and I need to execute an action on the database daily, even if the computer is powered off. In big lines, a membership expires in 30 days. And I need to keep tracks of how many days there are left. So how can I have MySQL subtract 1 from 30 each day? Thanks in advance!

Link to comment
Share on other sites

This obviously isn't going to work unless the database server is running, but you need to set up a scheduled task to execute some code. Windows uses Scheduled Tasks for that, and Linux uses cron jobs. You can either have it execute a PHP script to do the update, or you can use a command line to execute mysql and have it run a series of queries from a text file.You could also just store the expiration date itself instead of the number of days until it expires, and then you don't need to count down.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...