Jump to content

[SOLVED] Not sure if my script is wrong or its the time zone difference on the server!!!!


Voodoo Jai

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.