Jack.Straw Posted December 2, 2006 Share Posted December 2, 2006 I have a scenario where i'll need an email to be sent containing selected contents of a database. I've tried building the email as a variable and then using the variable as the email body, but I can't seem to figure out how to force a carriage return. I would like all items listed on a separate line. Can I somehow put conditionals and loops within the body tag? This is the logic behind what i'm trying to do:[code]$result=mysql_query("SELECT * from SoldItems WHERE OrderNumber='$userID'");while ($row=mysql_fetch_array($result)) { //DisplayInEmail: $row[Qty] - $row[Item]; }[/code]I tried doing something like:[code]$result=mysql_query("SELECT * from SoldItems WHERE OrderNumber='$userID'");while ($row=mysql_fetch_array($result)) { $Display=$Display."$row[Qty] - $row[Item]<br>";}$mailer->Body = "$Display";[/code]... but that relies on html for the carriage return and I need the emails in plain text.Thanks in advance for any advice you can offer!-Jack Link to comment https://forums.phpfreaks.com/topic/29229-phpmailer-how-do-i-display-arrays/ Share on other sites More sharing options...
kernelgpf Posted December 2, 2006 Share Posted December 2, 2006 HTML doesn't work in standard email, use "\n" instead. Link to comment https://forums.phpfreaks.com/topic/29229-phpmailer-how-do-i-display-arrays/#findComment-133988 Share on other sites More sharing options...
Jack.Straw Posted December 2, 2006 Author Share Posted December 2, 2006 Ahhhh, \n... that's the ticket. Thanks, that worked great! Link to comment https://forums.phpfreaks.com/topic/29229-phpmailer-how-do-i-display-arrays/#findComment-134008 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.