Forum Moderators: coopster
I wrote this script to check my MySQL table, and to send an email to all enteries where the date was equal to today's date and where delivered="no". After all the emails were sent, then the script was to set delivered="yes" for all enteries in my table where the date was equal to today's date.
What I got was a vicious loop cycle where it just sent out thousands of emails to my email account.
Please, show me where my bug is:
while($email=mysql_fetch_array(mysql_query("SELECT * FROM table WHERE date=CURDATE() AND delivered='No'"))){
mail($email["to"],"Subject","Body",$from_headers);
}
mysql_query("UPDATE table SET delivered='Yes' WHERE date=CURDATE()");