Get ready for BLACK FRIDAY shopping starting in

Forums

PHP

This topic is locked

MY EMAIL REMINDER SCRIPT

Posted 18 Feb 2004 01:24:26
1
has voted
18 Feb 2004 01:24:26 Frank Munoz posted:
Guys, I need help.

I put together this code, while referencing another example I found online, that will run a query and filter any email reminders that need to be sent on a preset date. Once the emails are sent, another query is supposed to update a column called "LastReminded" with the date the query ran.

I guess what I need is for someone to look over the code and check to see why it's not working right or am I missing something to make it work appropriately.

Thanks in advance...


<?php
mysql_select_db($database_elgallitoingles_PHP, $elgallitoingles_PHP);
$query_Reminders = "SELECT ReminderID, Email, EmailSubject, EmailBody, ' ' as EmailFrom FROM reminder_item, reminder_subject WHERE DATE_SUB(RemindDate, Interval RemindOffset DAY) <= Now() and LastReminded Is Null and reminder_subject.SubjectID = reminder_item.SubjectID";
$Reminders = mysql_query($query_Reminders, $elgallitoingles_PHP) or die(mysql_error());
$row_Reminders = mysql_fetch_assoc($Reminders);
$totalRows_Reminders = mysql_num_rows($Reminders);
$nr = mysql_num_rows( $query_Reminders );
while( $row_Reminders = mysql_fetch_array( $query_Reminders ) )
?>
<?php
if( !empty( $nr ) )
{
// Send out Reminder mail
$mailheader = "From: El Gallito Ingles Reminder System <$From>\nX-Mailer: Reminder\nContent-Type: text/plain";
mail("$Email","Reminder","$EmailSubject","$EmailBody";
// Update the sent reminders
mysql_query("UPDATE reminder_item SET LastReminder = Today() FROM reminder_item WHERE ReminderID = $row_Reminders['ReminderID'] );
}
?>

Reply to this topic