Erreur SQL ! INSERT INTO military VALUES ('15204609', 'City of Jethaya', '\'257:232', '', '0', '0', '0', '0', '0', '655', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '655', '655 berserkers'), ('15270146', 'jeth2', '\'258:233', '', '0', '0', '0', '0', '0', '16', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '16', '16 berserkers'),
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 '' at line 1
all the 24 variable on the table military are var char with sufficient room the first one is unique primary key the 4th variable is null what am i not seing :)
ps i just noticed a coma between the 2 lines of values the coma is also at the end of the second set of values could this be it ?
should add a comma after a set of values only when the set of values is not the one before the last (the last row is total). Please check this logic against your data. Maybe the logic should be changed.
I chnged the index names form $i to $row for more clarity but have forgoten to change it in this row. Sory for that.
Just to make sure how the logic goes, so you can check it:
The $parsedarray holds rows with data (say 5 for example) and the last row with Total information (6 all together) but we do not use the last row.
So count($parsedArray) equals 6 and indexes go from 0 to 5. But we need to proces only rows 1 to 5. (with indexes 0 to 4). Since $row represents the index and starts with 0, increasing by 1. So the logic is:
process all rows except last (for($row = 0; $row < (count($parsedArray) - 1); $row++))
if index is less than array lenght (e.g. 6) minus two (e.g. indexes 0 to 3) then add comma
if index is not less than array lenght (e.g.6) minus two (e.g. so only the last index - 4) then do not add comma
well thanks a lot you been great both you and Diafol
now i have just one more question if i wanted to access the first data of the first row
would i do something like this print_f '$parsedarray';
i was planning on accessing the first data of each row wich is the city id number (15270146) and from that tell the script to either make a new entry in the table (if that city is not there) or update it (if its there)
but ill look into the sql fonctions maybe there is one that already do this by default
one thing is sure tho i understand a litle bit more about arrays now ty