Here's a fragment of my code containing the elements pertinent to my question. I am trying to use a PHP data array to send data to the Import routine. I establish the array $keywords and apply preg_split in a loop to the lines of US.txt. I have verified that preg_split is working as expected insofar as it fills the array with the geonames data elements .
$keywords = preg_split(.....
$sql = 'INSERT INTO pset8.places '.
'(id,country_code,postal_code,place_name,admin_name1,admin_code1,admin_name2,admin_code2,admin_name3,admin_code3,latitude,longitude,accuracy) '
'VALUES(NULL,$keywords[0],$keywords[1],$keywords[2]$,keywords[3],$keywords[4],$keywords[5],$keywords[6],$keywords[7],$keywords[8],$keywords[9],$keywords[10],$keywords[11])';
However, the data is failing to get written to the SQL data base. Here is the error message I get -
Could not enter data: 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 '[0],$keywords[1],$keywords[2]$,keywords[3],$keywords[4],$keywords[5],$keywords[6' at line
I am not looking for the correct code. Just some guidance as to why the above is not working, what I'm not considering or not understanding. Thanks.