Hi; I have figured out how to upload a .csv file to a directory on my server. Now I want to take it and parse each row as a string to be used in a MySQL insert.
Before you point me to the "load infile" stuff, I don't think that is going to work AND I also want to add some additional fields/data to the insert statement.
So, here is what I am trying to get at:
the order of script operations is:
-open the file "imported.csv";
-skip the top row (which will have (incorrect) fieldnames only).
-use each row in turn to form the following string
(I can skip the "(fieldnames) values " part as the input will have a complete column set).
$query="insert into mytable ([entire_csv_row]";
$query.= "xtra_colvalue_1","xtra_colvalue_2","xtra_colvalue_3","xtra_colvalue_4",'')
I figure I might be able to cut apart the lines with explode() or something like that. But how do I get "imported.csv" opened to use in such an operation?
Or is my head completely up my butt on this one?