The code below sends out to anyone who had an appointment logged 30 days ago, even if they have made another appointment for after that..
Code: Select all
$sql = mysql_query("SELECT t.*, c.*
FROM timeslots as t
JOIN clients as c ON c.clientid = t.clientid
WHERE timeslot >= CURRENT_DATE - INTERVAL 31 DAY
AND timeslot < CURRENT_DATE - INTERVAL 30 DAY");