I need some help with a cron job... I have this PHP script that I would like to run once a day:
<html>
<head>
<title>Send Reminder</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?PHP
$reminderdate = date ("Y-m-d");
$email = "ryan@infinitypages.com";
$dbh=mysql_connect ("localhost", "infini15_ryan", "nonny") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("infini15_reminder");
$query = "SELECT * FROM reminder where reminderdate < '$reminderdate'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
mail("$email", "Notice for domain $row[1]","The domain $row[1] is set to expire on $row[3]\n\nThe domain $row[1] hosting expires on $row[2]\n\nThe message was:\n\n$row[4]\n\nGo to [url]http://www.infinitypages.com/reminder/findname.php?search=[/url]$row[1] to update the information.", "from: Infinity Domain Notice\r\n");
echo ("Domain Name: $row[1]<br>");
echo ("Hosting Expires: $row[2]<br>");
echo ("Domain Registration Expires: $row[3]<br>");
echo ("Message: $row[4]<br>");
$x = 1;
}
if ($x == 0)
{
echo ("Sorry, no information available for $reminderdate. Please try again");
}
?>
</body>
</html>
But when I try to run it, I get this error:
/home/infini15/public_html/reminder/sendreminder.php: html: No such file or directory
/home/infini15/public_html/reminder/sendreminder.php: head: No such file or directory
/home/infini15/public_html/reminder/sendreminder.php: title: No such file or directory
/home/infini15/public_html/reminder/sendreminder.php: meta: No such file or directory
/home/infini15/public_html/reminder/sendreminder.php: /head: No such file or directory
/home/infini15/public_html/reminder/sendreminder.php: body: No such file or directory
/home/infini15/public_html/reminder/sendreminder.php:
: command not found
/home/infini15/public_html/reminder/sendreminder.php: ?PHP
: No such file or directory
/home/infini15/public_html/reminder/sendreminder.php:
: command not found
/home/infini15/public_html/reminder/sendreminder.php: line 10: syntax error near unexpected token ("'
/home/infini15/public_html/reminder/sendreminder.php: line 10:$reminderdate = date ("Y-m-d");
'
Does anyone know what I can do so that I can run the above PHP script once a day? Any help is appreciated.