well i went through your script line by line on
change $filehandle=fopen($filename , 'rb');
windows is really picky and only will read the file in binary. (Read!)
and next your path has to be wrong!.
brad no offence but windows doesn't use file permissions like linux or OSX
require("connect.php");
$filename = "O:/Common/Common-Parts/JK/Uptime/UPTIMEPS.TXT";
if (file_exists($filename))
{
$connectmysql = mysql_connect($host,$user,$password) or die ($cantconnectmysqlmessage);
$db = mysql_select_db($databaseinv,$connectmysql) or die ($cantconnectdatabasemessage);
}
else { trigger_errror('failed to open file' . $filename . 'file path is wrong or file permissions set.' );}
$delete_query = "DELETE FROM tbluptimeinv ";
if (! $delete_result = mysql_query($delete_query)){
$mcrmessage = mysql_error();
echo "$mcrmessage<br>";
die();
}
// Central Standard Time
date_default_timezone_set('America/Chicago');
$timenow = date("Y-m-d H:i:s");
// Central Standard Time
/*--- READING IN THE FILE ---*/
$file_handle = fopen($filename, "r");
while (!feof($file_handle)) {
$line = fgets($file_handle);
IF(TRIM(SUBSTR($line,0,17))<>""){$NAV_PN = TRIM(SUBSTR($line,0,17));}ELSE{$NAV_PN = "";}
IF(TRIM(SUBSTR($line,17,6))<>""){$ONHUPTWC = TRIM(SUBSTR($line,17,6));}ELSE{$ONHUPTWC = "";}
IF(TRIM(SUBSTR($line,24,6))<>""){$ONHUPTRN = TRIM(SUBSTR($line,24,6));}ELSE{$ONHUPTRN = "";}
IF(TRIM(SUBSTR($line,31,6))<>""){$ORDUPTWC = TRIM(SUBSTR($line,31,6));}ELSE{$ORDUPTWC = "";}
IF(TRIM(SUBSTR($line,38,6))<>""){$ORDUPTRN = TRIM(SUBSTR($line,38,6));}ELSE{$ORDUPTRN = "";}
echo $NAV_PN;
$insert_query = "INSERT INTO tbluptimeinv
(TIMESTAMP, NAV_PN, ONHUPTWC, ONHUPTRN, ORDUPTWC, ORDUPTRN)
VALUES
('$timenow', '$NAV_PN', '$ONHUPTWC', '$ONHUPTRN', '$ORDUPTWC', '$ORDUPTRN')";
if (!($insert_result = mysql_query($insert_query)))
{
$mcrmessage = mysql_error();
echo $mcrmessage . "<br><br>" . $insert_query;
die();
}
}
header("Location: http://whqpc-001588/SMR/EComm.php");
fclose($file_handle);
}
?>