I have this script which creates a fake tempurature on my website. Based on the time of day and the month. It is supposed to update every hour but the cron job does not do it. The script works if i execute it manually.
This is the code of the script:
<?php
$month = date("n");
$hour = date("H");
$marray = array(1 => -17, 2 => -14, 3 => -6, 4 => 4, 5 => 12, 6 => 17, 7 => 20, 8=> 18, 9 => 12, 10 => 6, 11 => -4, 12 => -14);
$tarray = array("00" => "2.25", "01" => "1.5", "02" => "0.75", "03" => "0", "04" => "0.75", "05" => "1.5", "06" => "2.25", "07" => "3.0",
"08" => "3.75", "08" => "4.5", "09" => "5.25", "10" => "6.0", "11" => "6.75", "12" => "7.5", "13" => "8.25", "14" => "9.0",
"15" => "8.25", "16" => "7.5", "17" => "6.25", "18" => "6.0", "19" => "5.25", "20" => "4.5", "21" => "3.75", "22" => "3.0", "23" => "2.5");
$temp = round($marray[$month] + $tarray[$hour]) + rand(-2, 2);
include("$DOCUMENT_ROOT/functions.php");
mysql_query("UPDATE tempurature SET tempurature = '$temp' WHERE id = '1'") or die(mysql_error());
?>