On Thu, Feb 18, 2010 at 5:31 PM, OBXer <d...@therealouterbanks.com> 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.



PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to