$firstEmail = true; $textList = ""; $firstText = true; $callList = ""; $firstCall = true; while ($row = mysql_fetch_assoc($result)) { if ($row['Email_Preferred'] == 1) { if (!$firstEmail) { $emailList .= ","; } $emailList .= $row["Email"]; $firstEmail = false; } if ($row['Text_Preferred'] == 1) { if (!$firstText) { $textList .= ","; } $textList .= $row["Phone_Number"]; $firstText = false; } if ($row['Call_Preferred'] == 1) { if (!$firstCall) { $callList .= ","; } $callList .= $row["Phone_Number"]; $firstCall = false; } } SendEmails($emailList, "North Texas Food Bank Notification", "This is a reminder that you are scheduled to volunteer tomorrow!", "*****@*****.**"); SendTexts($textList, "This is a reminder that you are scheduled to volunteer tomorrow at the North Texas Food Bank!"); echo "Notifications sent! Do not reload this page!";
<?php include "sendEmails.php"; require "include.php"; $id = $_POST["data"]; $query = "UPDATE VOLUNTEER_LIST SET Is_Verified=1 WHERE ID=" . $id; //echo $query; if (!mysql_query($query)) { die(mysql_error()); } echo "Your request has been successfully entered, you will receive a confirmation shortly."; $query = "select Email from VOLUNTEER_LIST where ID=" . $id; //echo $query; if (!($result = mysql_query($query))) { die(mysql_error()); } $row = mysql_fetch_assoc($result); SendEmails($row["Email"], "Confirmation", "You have been approved for to volunteer at North Texas Food Bank!", "*****@*****.**");
$firstEmail = true; $textList = ""; $firstText = true; $callList = ""; $firstCall = true; while ($row = mysql_fetch_assoc($result)) { if ($row['Email_Preferred'] == 1) { if (!$firstEmail) { $emailList .= ","; } $emailList .= $row["Email"]; $firstEmail = false; } if ($row['Text_Preferred'] == 1) { if (!$firstText) { $textList .= ","; } $textList .= $row["Phone_Number"]; $firstText = false; } if ($row['Call_Preferred'] == 1) { if (!$firstCall) { $callList .= ","; } $callList .= $row["Phone_Number"]; $firstCall = false; } } SendEmails($emailList, "North Texas Food Bank Cancelation", "Due to unforseen circumstances tomorrow's volunteer event has been canceled. Sorry for the inconvenience.", "*****@*****.**"); SendTexts($textList, "Due to unforseen circumstances tomorrow's volunteer event at the North Texas Food Bank has been canceled. Sorry for the inconvenience."); echo "Cancelations sent! Do not reload this page!";