Hi,
I'm working on a script where a client can upload a txt file made from microsoft excel containing the inventory of all of his clients to the database. Later I will make it so the clients can type in their individual account numbers to view their inventory. But for right now I'm having trouble sending the data to the DB from the txt file.
Everytime I try to run the code below I get an error that says...
Parse error: parse error, unexpected T_STRING in /home/username/public_html/test.php on line 14
Here's the code. I looked it over and I guess I'm just blind because I can't seem to find exactly what the problem is. Can anyone lend me a hand? Thanks in advance!
<?php
@ $db = mysql_pconnect('localhost', 'user', 'password');
if (!$db)
{
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
mysql_select_db('evanbart_test');
$file = "InventoryUpload.txt";
$query = "LOAD DATA INFILE '$file' INTO TABLE inv (client, anum, qnty, uom, pon, rnu, des, ware) FIELDS TERMINATED BY \';\'
ENCLOSED BY \'|\' ESCAPED BY \'\\' LINES TERMINATED BY \'\r\n\'';
$result = mysql_query($query) or die ("Error: $query" . "mysql_error());
if ($result)
echo ' Data Inserted Into The Database.<br>';
?>