EDIT: Copied wrong part of function into this question, below is the appropriate one.
$values = mysql_query('SELECT lname, fname, email, dtelephone, etelephone, contactwhen, thursday, friday, saturday, sunday, monday, comments FROM volunteers_2009 WHERE venue_id = $venue_id'); while ($rowr = mysql_fetch_row($values)) { for ($j=0;$j<$i;$j++) { $csv_output .= $rowr[$j].', '; } $csv_output .= '\n'; }
I have comments that may have a comma in it, and even double quotes, when it has a comma in the comment field, it throws off the entire csv file.
The code below is how it loads the data into the csv string, to put into a csv file.
How do I get it to export the comments field data properly?
Enclose the field in double quotes. Double up any embedded double quotes.
Note that this is very, very close to the question Dealing with commas in a CSV file