3

i have table invoice in my database that contain atributes 'due date', 'date' and 'status'. What i want is data on 'status' change automatically. Example, status (unpaid change to expired) when date past the due date. Does it make sense ?

oNare
  • 3,231
  • 2
  • 22
  • 35
Adi Satria
  • 31
  • 3

1 Answers1

2

There are two ways to do this. The more traditional way is with a cron job on the server:

http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5

Another way is to do it with MySQL events:

https://dev.mysql.com/doc/refman/5.6/en/events.html

I personally prefer to keep this kind of logic in the app via a cron job and keep mysql events dedicated to db maintenance related items (partition maintenance for instance).

winmutt
  • 155
  • 5