Page 1 of 1

Problem with reading a file and inserting into table[Solved]

Posted: Thu Nov 06, 2003 3:15 pm
by infolock
hello again :) first, i want to thank everyone who has helped me through my learning process. lots of help has been provided and it's all done wonders. however, i have a new problem...

currently, my script is reading a file, and when it gets to line 4, it parses the data and assigns it to an array. i'm trying to dump that array into a table, but i'm having problems. here is the call

Code: Select all

<?php
    elseif ($line_no > 4) 
    { 
     // Read column and update.
                 $info_data = preg_split("/[\s]+/", $line_data);
                 $qry="insert into TABLE loginfo values('".$info_data[0]."','".$info_data[1]."')";
                 mysql_query($qry) or die(mysql_error());
     }

?>
however, when i run this, it gives me this error message :
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'TABLE loginfo values('213.111.11.14','2003-10-18')' at line 1
i've tried sitting it outside of the loop, but it has the same result ( except it only reads the last value that the array is assigned but still generates the same error).

any help would be appreciated. 8O

Posted: Thu Nov 06, 2003 3:30 pm
by Weirdan

Code: Select all

insert into loginfo...
Notice that you can't use TABLE keyword in this context.

read this fine ;) manual...

Posted: Thu Nov 06, 2003 6:23 pm
by infolock
thanks :oops: