I have the following string:
$result = "category,date,product,cost
car,10/10/2005,toyota,3000
bike,12/12/2007,yamaha,1000";
I need to arrange the string into the best format to insert into a database (needs to be efficient as there might be lots of data also first row will not be needed).
The string is on new lines, so I can:
$n = explode("\n", $result);
which puts it in this format:
[0] => category,date,product,cost
[1] => car,10/10/2005,toyota,3000
[2] => bike,12/12/2007,yamaha,1000
now how would i go about formatting this to insert in a db, once again the solution needs to be efficient (for performance), also I would like the first row to not be inserted and finally on the insert I wish for the date to not be inserted.
Hope it makes sense, thanks for the help in advance.
--------edit---------------
The table (item) is structured with the following fields:
category, product, cost
thanks