Forum Moderators: coopster
May I ask for help with a query.
I need to send a scheduled email out to registered users, 6 months after their registration date. Therefore I need to create a file that I can cron.
I'm thinking "now" equals registered date plus 6 month...
Can someone translate that into a php/mysql database query. I would appreciate it.
-:)
$currentdate = date("y-m-d");
$sixmonthsafter = date("y-m-d", strtotime($currentdate." + 6 months"));
$query_records = "SELECT * FROM table_here WHERE date_field >= '".$sixmonthsafter."'";
$records_result = mysql_query($query_records) or die(mysql_error());
if (mysql_num_rows($records_result) > 0) { // Means Result NOT Empty
while($row_records = mysql_fetch_row($records_result)) {
// Do whatever you want
}
}
[edited by: Gian04 at 3:15 am (utc) on Aug. 3, 2007]