kc27 Posted September 6, 2006 Share Posted September 6, 2006 Hello AllI want to change my script so that it outputs a comma separated text. Immediately below is what I started with, and below that is what I changed it to in order to get it to put CSV text in the email body.I get an error stating that: Parse error: parse error, unexpected '\"' in in retention.php on line 81Any ideas on what change I need to do to fix this?Thanks in advance for your helpTHIS IS A PORTION OF THE ORIGINAL SCRIPT//Sending Email to form owner$pfw_header = "From: me@myemail.com\n" . "Reply-To: me@myemail.com\n";$pfw_subject = "Retention Summary";$pfw_email_to = "you@youremail.com";$pfw_message = "Visitor's IP: $pfw_ip\n". "sflteam: $sflteam\n". "teamemail: $teamemail\n". "Last_Name_drop: $Last_Name_drop\n". "First_Name_drop: $First_Name_drop\n". "pos_drop: $pos_drop\n". "team_drop: $team_drop\n". "Last_Name_retain: $Last_Name_retain\n". "First_Name_retain: $First_Name_retain\n". "pos_retain: $pos_retain\n". "team_retain: $team_retain\n";@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;THIS IS THE PORTION OF THE SCRIPT AFTER I EDITED IT//Sending Email to form owner$pfw_header = "From: me@myemail.com\n" . "Reply-To: me@myemail.com\n";$pfw_subject = "Retention Summary";$pfw_email_to = "you@youremail.com";$pfw_message = "Visitor's IP: $pfw_ip\n""$sflteam", "$Last_Name_drop", "$First_Name_drop", "$pos_drop", "$team_drop", "$Last_Name_retain", "$First_Name_retain", "$pos_retain", "$team_retain";@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; Quote Link to comment https://forums.phpfreaks.com/topic/19931-want-to-change-output-to-csv/ Share on other sites More sharing options...
Daniel0 Posted September 6, 2006 Share Posted September 6, 2006 What are you trying to do in the second example? Quote Link to comment https://forums.phpfreaks.com/topic/19931-want-to-change-output-to-csv/#findComment-87298 Share on other sites More sharing options...
kc27 Posted September 6, 2006 Author Share Posted September 6, 2006 Rather than have the script put the data in single lines like this:cavaliersjoneslbI want it to put the values in a CSV line (in the body of the email) like this:cavaliers, jones, lb Quote Link to comment https://forums.phpfreaks.com/topic/19931-want-to-change-output-to-csv/#findComment-87322 Share on other sites More sharing options...
obsidian Posted September 6, 2006 Share Posted September 6, 2006 well, if you can get all the records into an array, simply use implode() with commas as the delimiters to make a row. to make a CSV file, typically you'll need to change your content-type to text/plain or something similar and output newlines at the end of each row.i'm not sure exactly what you're after here... any more explanation? Quote Link to comment https://forums.phpfreaks.com/topic/19931-want-to-change-output-to-csv/#findComment-87324 Share on other sites More sharing options...
sasa Posted September 6, 2006 Share Posted September 6, 2006 try[code]$pfw_message = "Visitor's IP: $pfw_ip\n"."$sflteam, $Last_Name_drop, $First_Name_drop, $pos_drop, $team_drop, $Last_Name_retain, $First_Name_retain, $pos_retain, $team_retain";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19931-want-to-change-output-to-csv/#findComment-87350 Share on other sites More sharing options...
kc27 Posted September 6, 2006 Author Share Posted September 6, 2006 Thanks all for the help. This is the kind of output (in the body of an email) that I was after:Visitor's IP: 65.243.45.100 DKN, Brown, J, Driver, OH, Green, A, Loader, PAI tried sasa's example and that worked. Obsidian, I wasn't necessarily trying to create a CSV file, although someone is sure to ask for a CSV file next instead of the data in an email message, so thanks for that bit of advice. Quote Link to comment https://forums.phpfreaks.com/topic/19931-want-to-change-output-to-csv/#findComment-87367 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.