inaba Posted February 24, 2008 Share Posted February 24, 2008 hi I am exporting some data in csv format.But the problem is the data itself contains comma. Plz help,if anyone knows how to put "," (Comma ) in a csv file. Link to comment https://forums.phpfreaks.com/topic/92702-csv-file/ Share on other sites More sharing options...
GingerRobot Posted February 24, 2008 Share Posted February 24, 2008 As far as im aware, if you place quotes around the commas they will be escaped. Link to comment https://forums.phpfreaks.com/topic/92702-csv-file/#findComment-475004 Share on other sites More sharing options...
Barand Posted February 24, 2008 Share Posted February 24, 2008 Use quotes <?php echo '$a,$b,"$var_with_comma",$c' . "\n"; <?php $fp = f open ('my.csv', 'w'); $data = array (1, 'abc', 'Hello, world', 42); f putcsv($fp, $data, ',', '"'); f close($fp); ?> // output --> 1,abc,"Hello, world",42 Link to comment https://forums.phpfreaks.com/topic/92702-csv-file/#findComment-475006 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.