Hello everyone,
I have searched various forums for a solution to my problem, but haven’t found the one that suits my needs.
Here is my situation: I need to send email reminders to two volunteer-referees of a sportsclub. These reminders have to be sent 7 days and 1 day in advance of the day they have to referee on (so in total 4 reminders have to be sent to two people, each referee receiving an email 7 days and one 1 day in advance).
The date, name of volunteers and the volunteers e-mail are all in the same table in the mysql-database.
DB table ‘referee_schedule’ is the table and consists of the following information:
Column 1: Event_date
Column 2: Event_name (the match they have to referee)
Column 3: Referee_1
Column 4: Referee_2
Column 5: Email_referee_1
Column 6: Email_referee_2
What is the best and easiest way to write a php script that checks if it is 7 or 1 day(s) in advance of event date, and if this is true, send a simple html email reminder to both referees.
If I am correct I need to use a ‘select’ line that looks something like this: (?)
SELECT * FROM referee_schedule WHERE
event_date CURDATE()+INTERVAL 7 DAY
OR CURDATE()+INTERVAL 1 DAY
I believe this topic (Send automatic email by date HELP! - #10 by chris331) comes pretty close to what I need, but I have no idea how to adapt it to my situation.
Btw, if my DB-table and script will be more effective by storing the actual events (event table with only event_name, event_date and referee) and the email of referees (referee and email_referee) in separate tables; this is possible, as the tables are not filled yet.
My knowledge of php is ‘basic’; I know what separate lines do, but I’m definitely not able to write a full script.
Thanks you in advance! Help would be really appreciated!
(PS sorry for my English. It’s not my first language)