I want to set a cron up that will check a database and send out emails depending on the results. I'm not 100% sure how to do this though. I know how to set the cron up, but wanted some help on the sending out the emails.
I want the database to be searched for numbers and if the same number has been entered by more than one person one email to be sent out, a different email to be sent out if only one person has selected a number. And another email to be sent out to the person with the lowest unique number. I've got:
PHP Code:
<?php
$con = mysql_connect("hostname/server IP","username","password");
if (DB::result("SELECT number FROM user WHERE number = number") != "")
{
mail("SELECT email FROM user","You share your number");
}
else
{
mail("SELECT email FROM user","Your number is unique");
}
if (DB::result("SELECT number From user WHERE number < ")
{
mail("SELECT email FROM user","You have the lowest unquie number");
}
mysql_close($con);
?>
but am not sure if I've got the syntax right or if it will work. I'd be grateful for any help please.
Thanks
|