Hi,
I need some help with sending emails to registered users in my database after a specific record is updated. and the emails will have few details after the record updated so basically it will have 2 different queries and will send the email also. I have this working code in my separate php file but i dont know how it will work in phprunner.
Please help.
$sql = "SELECT email FROM accounts ";
$result = mysql_query($sql) or die ('Error in query: $query. ' . mysql_error());
if (mysql_num_rows($result) > 0)
{
while($row = mysql_fetch_assoc($result))
{
$email = $row['email'];
$sql1 = "SELECT * FROM table where new = 5 and payment = 'Completed' ";
$result1 = mysql_query($sql1) or die ('Error in query: $query. ' . mysql_error());
if (mysql_num_rows($result1) > 0)
{
while($data = mysql_fetch_assoc($result1))
{
$ref=$data["ref"];
$subject = "Subject";
$subject4 = "Subject";
$message= "Check out the portal for more details\n" .
//"$ref" .
"Email Message ".
"\n\n------------------------------------------------------------\n" ;
mail($email, $subject, $message,"From: $email5\nReply-To: $email5");
mail($email11, $subject, $message,"From: $email5\nReply-To: $email5");
$sqlupdate = "UPDATE table set new = 4 where ref = '$ref' ";
$resultupdate = mysql_query($sqlupdate) or die ('Error in query: $query. ' . mysql_error());
}
}
}
}
else
{
echo "Error Mesage.!";
}
mysql_close($connection);
Regards