I am trying to send a different email to users after the confirmation of registration. One will be for admin users and the other text will be for basic users. I wrote and if else statement based on queried data but its sending both emails to both types of users. Any idea what is wrong?
function SendBusWelcomeEmail(&$user_rec)
{
$result = mysql_query("SELECT business FROM users")
or die(mysql_error());
if($result='a') {
$mailer = new PHPMailer();
$mailer->CharSet = 'utf-8';
$mailer->AddAddress($user_rec['email'],$user_rec['name']);
$mailer->Subject = "Welcome to ".$this->sitename;
$mailer->From = $this->GetFromAddress();
$mailer->Body ="Thank You ".$user_rec['name']." for joining xxx,
".
"We are a brand new business with big ambitions. Our mission is to help the development of your skills
".
"
".
"Regards,
".
"Webmaster
".
$this->sitename;
}
if(!$mailer->Send())
{
$this->HandleError("Failed sending user welcome email.");
return false;
}
else{
$mailer = new PHPMailer();
$mailer->CharSet = 'utf-8';
$mailer->AddAddress($user_rec['email'],$user_rec['name']);
$mailer->Subject = "Welcome to ".$this->sitename;
$mailer->From = $this->GetFromAddress();
$mailer->Body ="Hello ".$user_rec['name']."
".
"Welcome! Your registration with ".$this->sitename." is completed.
".
"
".
"Regards,
".
"Webmaster
".
$this->sitename;
if(!$mailer->Send())
{
$this->HandleError("Failed sending user welcome email.");
return false;
}
}
}