To get around the comma problem you can enclose your
fields in quotes:

"column 1 da,ta","colu,mn 2 data","column,3 data"

As far as the newline characters I don't know if its
feasible for your particular project but you could
strip the newline characters out with something like
this:

$new_string = str_replace("\n", "", $old_string);

If you still get little garbage square characters in
excell you may even have to specify "\r\n" instead of
just "\n".


If you do need those newline characters in excell
perhaps you could replace them with something obvious
like:

$new_string = str_replace("\n", "[FIX THIS]",
$old_string);

And then do a find replace on "[FIX THIS]" afterwards
in excell.

Theres probably a more elegant way to do it but I
don't know it ;)

--- dwight ian  <[EMAIL PROTECTED]> wrote:
> Good day to you All,
>  
> Hi Im working on a project where it is nessary to
> download the values of the tables in the database
> and 
> format them in csv (comma separated values) files in
> order for them to be viewed in a spreadsheet 
> application (ie Microsoft Excel).
>  
> The problem happens when the values in the tables
> includes commas and new line, it disrupts the csv
> file. 
> What will I do?, Please help.
> 
> Lycos recommends Cheapflights for all your travel
> needs. Go to
> http://www.cheapflights.co.uk/?source=lycosgen
> 
> 
> > -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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

Reply via email to