jaypotter Posted January 14, 2010 Share Posted January 14, 2010 I am using the code below to send data to a csv file. When it displays in the file, then last column puts am " at the end of the column. I have tried to different variations of "\"\n" and I can't get it right. I have attached a screen shot of the csv file. Any help is greatly appreciated. header("Content-type:text/octect-stream"); header("Content-Disposition:attachment;filename=data.csv"); print 'Vendor,Name' . "\"\n"; print 'Vendor2,Name2' . "\"\n"; [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/188456-print-to-csv-problem/ Share on other sites More sharing options...
Buddski Posted January 14, 2010 Share Posted January 14, 2010 Have you tried header("Content-type:text/octect-stream"); header("Content-Disposition:attachment;filename=data.csv"); print 'Vendor,Name' . "\n"; print 'Vendor2,Name2' . "\n"; Link to comment https://forums.phpfreaks.com/topic/188456-print-to-csv-problem/#findComment-994912 Share on other sites More sharing options...
JAY6390 Posted January 14, 2010 Share Posted January 14, 2010 print '"Vendor","Name"' . "\n"; print '"Vendor2,Name2"' . "\n"; Not sure which of the above you were after to be honest, but hopefully it was one of them Link to comment https://forums.phpfreaks.com/topic/188456-print-to-csv-problem/#findComment-994917 Share on other sites More sharing options...
jaypotter Posted January 14, 2010 Author Share Posted January 14, 2010 This worked! I thought I had tried that earlier, but I guess I didn't. Thanks header("Content-type:text/octect-stream"); header("Content-Disposition:attachment;filename=data.csv"); print 'Vendor,Name' . "\n"; print 'Vendor2,Name2' . "\n"; Link to comment https://forums.phpfreaks.com/topic/188456-print-to-csv-problem/#findComment-994921 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.