scott.stephan Posted June 15, 2009 Share Posted June 15, 2009 This is probably a dumb question, but I've been up for almost 48 hours and I just wanna smash this problem to pieces! Anyway- I'm Fputcsv 'ing and I want everything on ONE LINE. Instead, I'm getting 4 seperate lines: $list = array ( "$curr_po_num","1","$curr_carrier","$curr_pro" ); $filename=$curr_po_num."_validation.csv"; $fp = fopen($filename, 'w'); foreach ($list as $line) { fputcsv($fp, split(',', $line)); } fclose($fp); I want: ponum,1,carrier,pro I'm getting: ponum 1 carrier pro Probably a really goofy error, I'm just running circles around myself. Link to comment https://forums.phpfreaks.com/topic/162204-php-fputcsv-line-breaking-wrong/ Share on other sites More sharing options...
youngmonkey Posted June 15, 2009 Share Posted June 15, 2009 Try this: $list = array ( "$curr_po_num","1","$curr_carrier","$curr_pro" ); $filename=$curr_po_num."_validation.csv"; $fp = fopen($filename, 'w'); fputcsv($fp,$list); fclose($fp); Also, read the docs for fputcsv. HTH, M. Link to comment https://forums.phpfreaks.com/topic/162204-php-fputcsv-line-breaking-wrong/#findComment-856024 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.