Erindesign
04-29-2009, 06:30 PM
Hey all,
came up with a little string here that:
Uploads a text file
Gets data from text file one line at a time
Explodes each line by the TAB delimiter.
Inserts into a mysql database, and outputs.
It uploads the file, reads the file, outputs the results, but does not insert into mysql. Here is my mysql statement:
while($theData = fgets($fh)){
$part=explode("\t", $theData);
$sql="INSERT INTO items (customerid, itemname, modelnr, serialnr, condition, location, status, replacement, damage, diagnosis, fstate, labor, parts) VALUES ('$custid', '$part[0]', '$part[1]', '$part[2]', '$part[3]', '$part[4]', '$part[5]', '$part[6]', '$part[7]', '$part[8]', '$part[9]', '$part[10]', '$part[11]')";
mysql_query($sql, $conn) or die mysql_error();
....
Been messing with it for the past hour and cannot find whats wrong.
Thx in advance, Erind
came up with a little string here that:
Uploads a text file
Gets data from text file one line at a time
Explodes each line by the TAB delimiter.
Inserts into a mysql database, and outputs.
It uploads the file, reads the file, outputs the results, but does not insert into mysql. Here is my mysql statement:
while($theData = fgets($fh)){
$part=explode("\t", $theData);
$sql="INSERT INTO items (customerid, itemname, modelnr, serialnr, condition, location, status, replacement, damage, diagnosis, fstate, labor, parts) VALUES ('$custid', '$part[0]', '$part[1]', '$part[2]', '$part[3]', '$part[4]', '$part[5]', '$part[6]', '$part[7]', '$part[8]', '$part[9]', '$part[10]', '$part[11]')";
mysql_query($sql, $conn) or die mysql_error();
....
Been messing with it for the past hour and cannot find whats wrong.
Thx in advance, Erind