I am rying to create a page where i will send an automatic mail to an address in a database. can any body check my code here because i keep geing a parse error message.
<?
include("config.php");
// open a connection to the database
$connection = mysql_connect($server, $user, $pass);
// formulate the SQL query - same as above
$query = "SELECT * from calendar WHERE date='$this_date' order by time";
// run the query on the database
$result = mysql_db_query($db,$query,$connection);
if(myql_num_rows($result)>0)
{ while ($row=mysql_fetch_array($result))
{
$this_date=$row["date"];
$this_time=$row["time"];
$id=$row["id"];
$email=$row["email"];
$sent=$row["sent"];
if($sent=="NO")
if($email)
{ $formsent=mail($email, "Appointment Reminder", "This email is to remind you that your appointment with Daniel is scheduled at $this_time on the $this_date. Please do no reply this email. This is an automatically generated email", "From: Daniel@mail.com");}
$query2 = "UPDATE calendar SET sent='YES' WHERE id='$id'";
// run the query on the database
$result2 = mysql_db_query($db,$query2 ,$connection);
}
// close connection
mysql_close($connection);
?>