$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";
}
我有评论可能有逗号,甚至双引号,当它在注释字段中有逗号时,它会抛出整个csv文件.
下面的代码是如何将数据加载到csv字符串中,放入csv文件中.
如何让它正确导出注释字段数据?
最佳答案
用双引号括起该字段.加倍任何嵌入的双引号.
ordinary field,"field with,in it","field with double double quote ("""")"
请注意,这非常非常接近问题Dealing with commas in a CSV file