How can I compare the current date of the web server with a date I have stored in the mySQL database and 3 days before that that in the database to send a notification email ?
views:
143answers:
2
+1
A:
This will select rows whose mydate
is at least 3
days earlier than the current date:
SELECT *
FROM mytable
WHERE mydate <= SYSDATE() - INTERVAL 3 DAY
Quassnoi
2009-09-08 12:13:38
And to automatically send the e-mail can I use a cron-job that executes the script every day ?
2009-09-08 12:18:18
`@Prema`: sure you can.
Quassnoi
2009-09-08 13:11:11
A:
You just need to write a program which queries the db and get all email ids which has (now()-3) = field in db you are comparing against and send mail to those email ids and add it as a scheduled task/crontab which will get executed daily(schedule time when web server is less utilized).
Umesh
2009-09-08 12:19:42