Voodoo Jai Posted July 9, 2008 Share Posted July 9, 2008 I cannt figure out if my script to be run as a CRON-JOB is working or if I cannot get the time zone right to run it. Its a PHP script that deletes the rows of a table within my database. //CONNECTION DETAILS here <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_MY_conn, $MYconn); $query_IPStoreDelete = "SELECT * FROM ipstore"; $IPStoreDelete = mysql_query($query_IPStoreDelete, $MY_conn) or die(mysql_error()); $row_IPStoreDelete = mysql_fetch_assoc($IPStoreDelete); $totalRows_IPStoreDelete = mysql_num_rows($IPStoreDelete); //******************************************************************************************************** //******************************************************************************************************** // QUERY to delete the data from ipstore table older than 1 day the change, chnge the last figure // The server is set to CST time approx -6 hours difference //******************************************************************************************************** //******************************************************************************************************** $query ="mysql_query("delete from ipstore where to_days(now())-to_days(date) > 1")"; mysql_query($query); mysql_close() mysql_free_result($IPStoreDelete); ?> does this look right. Its in the root of my web site /usr/local/bin/php /hsphere/local/home/username/www.domain.com/file_name.php" Many thanks VoodooJai Link to comment https://forums.phpfreaks.com/topic/113981-solved-not-sure-if-my-script-is-wrong-or-its-the-time-zone-difference-on-the-server/ Share on other sites More sharing options...
Voodoo Jai Posted July 9, 2008 Author Share Posted July 9, 2008 Fter some digging I get an error msg like: Parse error: parse error, unexpected T_STRING in /hsphere/local/home/poochima/MY.com/Filename.php on line 43 Which refers to: $query ="mysql_query("delete from ipstore where to_days(now())-to_days(date) > 1")"; this line of code i think. Does this help. Link to comment https://forums.phpfreaks.com/topic/113981-solved-not-sure-if-my-script-is-wrong-or-its-the-time-zone-difference-on-the-server/#findComment-585821 Share on other sites More sharing options...
Helmet Posted July 9, 2008 Share Posted July 9, 2008 Look at your use of single and double quotes on that line. Link to comment https://forums.phpfreaks.com/topic/113981-solved-not-sure-if-my-script-is-wrong-or-its-the-time-zone-difference-on-the-server/#findComment-585838 Share on other sites More sharing options...
discomatt Posted July 9, 2008 Share Posted July 9, 2008 Why is your function call in quotes? Only quote strings $query = mysql_query("delete from ipstore where to_days(now())-to_days(date) > 1"); Link to comment https://forums.phpfreaks.com/topic/113981-solved-not-sure-if-my-script-is-wrong-or-its-the-time-zone-difference-on-the-server/#findComment-585839 Share on other sites More sharing options...
Voodoo Jai Posted July 9, 2008 Author Share Posted July 9, 2008 Just figured it out about the quotes, they were in from a post I quoted earlier. Thanks again All at phpfreaks Link to comment https://forums.phpfreaks.com/topic/113981-solved-not-sure-if-my-script-is-wrong-or-its-the-time-zone-difference-on-the-server/#findComment-585845 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.