Question
Basically I want to send reminder emails to the people who haven't accepted the challenge yet. From challenges table I get the emails who have been challenged and then from a_challenges table I get the emails (usernames) who have accepted the challenge.
Problem
I want to basically remove the email addresses which are in the a_challenges table from the array coming from challenges table as those people have already accepted the challenge so i don't want to send them an reminder email. Any help will be appreciated.
Code
<?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..
?>
Actual Output
Team==> AGS Larger Lads
Accepted==> Donald -- [email protected]
Accepted==> David -- [email protected]
Accepted==> Sean -- [email protected]
Send email to below mentioned address:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Expected Output
Team==> AGS Larger Lads
Accepted==> Donald -- [email protected]
Accepted==> David -- [email protected]
Accepted==> Sean -- [email protected]
Send email to below mentioned address:
[email protected]
[email protected]
[email protected]
[email protected]
SELECT ... FROM ... WHERE address NOT IN (SELECT address FROM teams)...or something along those lines. Let the database do it!