On Thu, Feb 18, 2010 at 5:31 PM, OBXer <dan@xxxxxxxxxxxxxxxxxxxxx> wrote: > > I'm trying to adopt this piece of code for my use. I fixed the csv_data .= > trim error. Does anyone know how I can fix empty fields? Everything is > dumping to a csv file but information is not matching up. I don't know if I > can insert a space or something if field is blank? > > If you're trying to write csv data, why not use fputcsv($_fp, $row) to write each line rather than concatenating all the lines into a single value and then writing that string to a file? It will correctly handle empty values (as long as the key is still present in the array) and I've found it to be much faster at writing larger data sets than trying to concatenate the CSV in code. http://www.php.net/manual/en/function.fputcsv.php Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php