This is a very simple thing to do, and I've done it before. I'm trying to take a spreadsheed which has been converted to a .txt file and simply grab the contents the ouput them with some additional information to a webpage (so I can then cut and paste the info into phpmyadmin).
But I keep getting a parse error on line 5 - I've tried with both a fullpath and also just the document name (which is located in the same folder at the script).
Anybody see something I'm missing - I'm stumped...ack.
// get file and contents
$filename = "/path/a.txt";
$handle = fopen($filename, "rb");
// the line below this is LINE 5
$contents = fread($handle, filesize ($filename));
fclose ($handle);
// get the rows
$stuff = explode("/n", $contents);
$n = count($stuff);
// loop the data into a nicer format
$s = "";
for($i=0; $i<$n; $i++) {
$s. = "INSERT INTO TABLE VALUES (" . $stuff[$i] . ")\n";
}
echo $s;