That's what I mean by starring at this too much :) I tried writting to a seperate file, but is there a way to take an array and split it every so many records within another loop?
Let's say the first row contains the first 18 columns which I already parsed, I then want to grab the next 5 15 columns, but need to seperate them in groups of 15. I tried this: foreach ($output as $key => $value){ $policyWriter = "$quoteKey|$key|$value"; fwrite ($policyFile,"$policyWriter\r\n"); } Which will take and print the rest of the row, but I needo split the columns into groups of 15. -Scott On Fri, 31 May 2002, Michael Davey wrote: > You should normalise your data - have a field in the second csv that links > to the first csv and then you can have as many rows as you want associated > with the record in the first file. > > Mikey > > "Scott" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I have a csv file that I am parsing, formatting and then writting to a new > > file. I am currently using an array, but I have some lines that might > > contain more data than others. I know for sure that columns 0-33 will > > always be there, but the customer has the option to add another set of > > columns to the row if needed. I do know that the addition's will always > > be 18 columns and I do know that they can add up to 15 set's of 18. So, > > the row length could be 0-33 or 0-51 if they add one additional set or 303 > > columns if they go up to 15. > > > > The tricky part is I have to format each column for the new file that is > > created, I do this using sprintf. I have so far tried to use array_slice > > for the first 18 columns, then I do another array_slice starting at 18 > > and using the column count to get the last column in the row. Here is the > > code: > > > > array_slice($fields, 18,$lineCount); > > foreach ($fields as $key => $value){ > > print "$key|$value\r\n"; > > } > > > > The format of the new file will be this: > > 01-Customer information > > 02-Other information > > 03a Required Info (that can repeat up to 15 times per line) > > 03b "" > > 04b "" > > 04-Close Customer Record > > > > Repeat cycle for each row. The inner loop happens between the 02 and 04 > > records. Remember, I need to format each individual column, they are > > different format options. > > > > If you have some thoughts, I would be all ears as I have been starring at > > this too long and too hard. > > > > Thanks, > > > > -Scott > > > > > > > > -- -------------------------------------------- [EMAIL PROTECTED] Now Playing: Moby - We Are All Made Of Stars generated by ProWeb 1.0 Beta Uptime 168 days c2002 Exton Communications -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php