[PHP] Re: splitting CSV rows into multiple SQL inserts?

2005-06-22 Thread Sergey
You can insert file data in DB first, using LOAD DATA INTO FILE, after it'll be easy to manipulate this DB table with a help of php-script. Vince LaMonica [EMAIL PROTECTED] ???/ ? ?: news:[EMAIL PROTECTED] I sent this note off to the php-db list last night, but the

Re: [PHP] Re: splitting CSV rows into multiple SQL inserts?

2005-06-22 Thread Vince LaMonica
On Wed, 22 Jun 2005, Sergey wrote: } You can insert file data in DB first, using LOAD DATA INTO FILE, after it'll } be easy to manipulate this DB table with a help of php-script. Actually, I can't, as the CSV contains fields for two different tables. I may have explained it better here: I

Re: [PHP] Re: splitting CSV rows into multiple SQL inserts?

2005-06-22 Thread Ben Duffy
I would read in the CSV file, and populate two arrays, using the ordernumber as a key in the header array, loop through the header array containg $o_num, $date, $name, $addr, to do the db inserts. The details table would be an array of arrays, key would be ordernumber again, then the sub array

Re: [PHP] Re: splitting CSV rows into multiple SQL inserts?

2005-06-22 Thread Vince LaMonica
On Wed, 22 Jun 2005, Ben Duffy wrote: } I would read in the CSV file, and populate two arrays, using the } ordernumber as a key in the header array, loop through the header array } containg $o_num, $date, $name, $addr, to do the db inserts. Ok, I think I get this, though I am confused about

Re: [PHP] Re: splitting CSV rows into multiple SQL inserts?

2005-06-22 Thread Ben Duffy
Vince, I have made a couple of changes in the code below, none of this has been tested, but I have done similar in the past. As long as u don't have too mauch data to read in, this method gives you the most flexibility. If the CSVs are large, you might have to process line by line instead of