How to make CSV output

They have: 71 posts

Joined: Mar 2004

I currently have part of a script from another function on my website, and it inserts values into a .csv file like this:

<?php
{
  
  
$csvcomments = $comment;
  
#$csvcomments =~ s/\\"/$csvquote/ig;

  
open (CSVF,\">>$csvfilename\");
   print CSVF \"\\"
\";
   print CSVF \"
$b_first\";
   print CSVF \"\\"
,\\"\";
   print CSVF \"
$b_last\";
   print CSVF \"\\"
,\\"\";
   print CSVF \"
$b_addr\";
   print CSVF \"\\"
,\\"\";
   print CSVF \"
$b_addr2\";
   print CSVF \"\\"
,\\"\";
   print CSVF \"
$b_city\";
   print CSVF \"\\"
,\\"\";
   print CSVF \"
$b_state\";
   print CSVF \"\\"
,\\"\";
   print CSVF \"
$b_zip\";
   print CSVF \"\\"
,\\"\";
   print CSVF \"
$comment\";
   print CSVF \"\\"
\n\";
   close CSVF;
}
?>

The problem is, I need a line break after each entry, and that isn't happening with the code above. What can I do about that?

He has: 1,380 posts

Joined: Feb 2002

after each line line, add \n...so

<?php
print CSVF \"$mystuff\n\";
?>

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.