Hi all. Hoping for a little assistance... I'm running this script as an "after record updated" event. It's working fine except that it's sending email to the entire database, not just "Administrators." So I suspect my "where" statement is incorrect.
Thank you in advance.
global $dal;
//select emails from Users table
$tblUsers = $dal->Table("Users");
$where {"UserType"}=("Administrator");
$rs = $tblUsers->QueryAll();
while ($data = db_fetch_array($rs))
{
$email=$data["Email"];
$from="myemail@myemail.com";
$msg="A new deal: has been made available!";
$msg.="Deal: ".$values["Business_Name"]."\r\n";
$subject="New Deal Available";
$ret=runner_mail(array('to' => $email, 'subject' => $subject,
'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"]."
";
}