In one of my web application ( in PHP and MySQL ) there is a event reminder for users. User can add the next reminder date and also put the repeat interval ( ie Only Once, 3 months, 6 months and yearly ). Saving that in table like
id      |    emp_id      |    alert_date         |   repeat_interval
--------+----------------+-----------------------+----------------------
1       |      124       |  2014-05-02 00:00:00  |     3
--------+----------------+-----------------------+----------------------
2       |      123       |  2014-05-02 00:00:00  |     12
--------+----------------+-----------------------+----------------------
3       |      122       |  2014-02-02 00:00:00  |     6
--------+----------------+-----------------------+----------------------
4       |      121       |  2014-07-02 00:00:00  |     0
--------+----------------+-----------------------+----------------------
5       |      124       |  2014-05-02 00:00:00  |     6
--------+----------------+-----------------------+----------------------
6       |      125       |  2014-08-02 00:00:00  |     6
--------+----------------+-----------------------+----------------------
7       |      126       |  2014-06-02 00:00:00  |     12
--------+----------------+-----------------------+----------------------
8       |      127       |  2014-05-02 00:00:00  |     3
------------------------------------------------------------------------
The repeat_interval having the value as
0 - One time event
3 - Every 3 months
6 - Every 6 months
12 - Yearly
Now I have a "cronjob" running every morning, searching for events and send alerts to users. I have the following MySQL query
SELECT * 
FROM alerts as al 
WHERE date(al.alert_date) = DATE_ADD(CURRENT_DATE, INTERVAL 1 DAY);
This will return the tmrw's alerts and I can send mail with this. But my question is how to take these intervals also ?
ie if the alert_date is 01-05-2013 and set repeat for 3 months then need to send mail on 01-05-2013 and the intervals of 3 months
Actually is this the correct way for this purpose ? Or I need to alter the tables ?
Can any one give me an idea ? Thanks in advance