''"; $csv_output = ''; $csv_output .= '"Name","Email","Website URL"'; $csv_output .= "\015\012"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $csv_output .= '"'.$row[comment_author].'","'.$row[comment_author_email].'", "'.$row[comment_author_url].'"'; $csv_output .= "\015\012"; } //You cannot have the breaks in the same feed as the content. header("Content-type: application/vnd.ms-excel"); header("Content-disposition: csv; filename=email-export.csv"); print $csv_output; exit; ?>