I have 2 tables, emaillist & solicitationlist. emaillist has name, email, variable1, variable2, variable3. solicitation list has title, description, variable1, variable2, variable3.
I want to add records to solicitationlist and have it email to those in emaillist whose variable1, variable2, variable3 are equal to 'yes'. I have this working, but I have duplicate emails to those who have selected 'yes' in variable1, variable2, and variable3.
How can I filter the duplicate emails to ensure each person gets one email no matter how many varaibles the users selects yes to?
Here is some code in before edit. same code is in before add in solicitationlist.
if ($values["variable1"] == "Yes")
{
$rs=db_query("select from emaillist where variable1='Yes'",$conn);
while($data=db_fetch_array($rs))
{ mail($data["Email"], $subject, $message, $headers); }
}
if ($values["variable2"] == "Yes")
{
$rs=db_query("select from emaillist where variable2='Yes'",$conn);
while($data=db_fetch_array($rs))
{ mail($data["Email"], $subject, $message, $headers); }
}
if ($values["variable3"] == "Yes")
{
$rs=db_query("select * from emaillist where variable3='Yes'",$conn);
while($data=db_fetch_array($rs))
{ mail($data["Email"], $subject, $message, $headers); }
}
thanks.