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. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.