问题
基本上我想向尚未接受挑战的人发送提醒电子邮件。从挑战表中我得到被挑战的电子邮件,然后从a_challenges表中我得到接受挑战的电子邮件(用户名)。
问题
我想基本上从来自挑战表的数组中删除a_challenges表中的电子邮件地址,因为这些人已经接受了挑战,所以我不想向他们发送提醒电子邮件。任何帮助将不胜感激。
代码
<?php
require_once('includes/dbConnector.php');
$dbCon = new dbConnector();//define the DB connection
$query_challenges = "Select distinct * from challenges";//query to fetch records from challenges table like usernames who have been challenged
//echo $query_challenges;
$result_challenges = $dbCon->query($query_challenges);//execute query
//start while loop to fetch the records
while($row_tr = $dbCon->fetchArray($result_challenges)){
$t_name = $row_tr['t_name'];
$c_emails = $row_tr['c_emails'];
echo "<br /><br />".$t_name."<br /><br />";
$query_a_challenges = "Select * from a_challenges where t_name='".$t_name."'";//query to fetch records from a_challenges table like usernames who have accepted the challenge, etc
//echo $query_a_challenges;
$result_a_challenges = $dbCon->query($query_a_challenges);//execute query
while($row_a_challenges = $dbCon->fetchArray($result_a_challenges)){
echo "Accepted==> ". $row_a_challenges['full_name']." -- ";
echo $row_a_challenges['username']."<br /><br />";
}//end while a_challenges..
//echo $c_emails."<br /><br />";
$c_emails = explode(',', $c_emails);
for($i=0; $i<count($c_emails); $i++){
echo $c_emails[$i]."<br />";
}//end for
}//end while challenges..
?>
实际输出
Team==> AGS Larger Lads
Accepted==> Donald -- donald@example.com
Accepted==> David -- david@example.com
Accepted==> Sean -- Sean@example.com
发送电子邮件至以下地址:
byrne@example.com
neil@example.com
brendan@example.com
Sean@example.com
donald@example.com
saunders@example.com
david@example.com
预期产出
Team==> AGS Larger Lads
Accepted==> Donald -- donald@example.com
Accepted==> David -- david@example.com
Accepted==> Sean -- Sean@example.com
发送电子邮件至以下地址:
byrne@example.com
neil@example.com
brendan@example.com
saunders@example.com