$username Posted September 29, 2008 Share Posted September 29, 2008 Hello All, I am setting up some email sending with PHP pulling info from MySQL. I have one question on how to make the message body. Here is the code I have. What is the key to getting the PHP loop to be equal to a value. $ToMail = '[email protected]'; $MsgSubject = "Daily Invoices Due"; $MsgBody = ( echo "<table>"; while($row589 = mysql_fetch_array($sql589)) { echo "<tr>"; echo "<td>".$row589['PaymentInvoiceID']."</td>"; echo "<td>".$row589['PaymentDueDate']."</td>"; echo "<td>".$row589['PaymentPaid']."</td>"; echo "<td>".$row589['PaymentAccountID']."</td>"; echo "</tr>"; } echo "</table>" ); Link to comment https://forums.phpfreaks.com/topic/126313-solved-sending-an-email-with-mysql-data/ Share on other sites More sharing options...
Maq Posted September 29, 2008 Share Posted September 29, 2008 What is the key to getting the PHP loop to be equal to a value. Could you please elaborate? I'm not entirely sure what you're asking. Link to comment https://forums.phpfreaks.com/topic/126313-solved-sending-an-email-with-mysql-data/#findComment-653156 Share on other sites More sharing options...
$username Posted September 29, 2008 Author Share Posted September 29, 2008 I want the value of $MsgBody = to echo "<table>"; while($row589 = mysql_fetch_array($sql589)) { echo "<tr>"; echo "<td>".$row589['PaymentInvoiceID']."</td>"; echo "<td>".$row589['PaymentDueDate']."</td>"; echo "<td>".$row589['PaymentPaid']."</td>"; echo "<td>".$row589['PaymentAccountID']."</td>"; echo "</tr>"; } echo "</table>"; Link to comment https://forums.phpfreaks.com/topic/126313-solved-sending-an-email-with-mysql-data/#findComment-653161 Share on other sites More sharing options...
ram4nd Posted September 29, 2008 Share Posted September 29, 2008 Maybe something like this? I want the value of $MsgBody = to echo "<table>"; while($row589 = mysql_fetch_array($sql589)) { echo "<tr>"; echo '<td>'.$row589[0].'</td>'; echo '<td>'.$row589[1].'</td>'; echo '<td>'.$row589[2].'</td>'; echo '<td>'.$row589[3].'</td>'; echo "</tr>"; } echo "</table>"; Link to comment https://forums.phpfreaks.com/topic/126313-solved-sending-an-email-with-mysql-data/#findComment-653164 Share on other sites More sharing options...
Maq Posted September 29, 2008 Share Posted September 29, 2008 $message = "</pre> <table>"; while($row589 = mysql_fetch_array($sql589)) { $message .= ""; $message .= "".$row589['PaymentInvoiceID'].""; $message .= "".$row589['PaymentDueDate'].""; $message .= "".$row589['PaymentPaid'].""; $message .= "".$row589['PaymentAccountID'].""; $message .= ""; } $message .= "</ta If you use $message in your body variable for the mail function then it will display all this info throughout the loop. Link to comment https://forums.phpfreaks.com/topic/126313-solved-sending-an-email-with-mysql-data/#findComment-653167 Share on other sites More sharing options...
$username Posted September 29, 2008 Author Share Posted September 29, 2008 Sweet thanks for that Maq. Brett Link to comment https://forums.phpfreaks.com/topic/126313-solved-sending-an-email-with-mysql-data/#findComment-653173 Share on other sites More sharing options...
Maq Posted September 29, 2008 Share Posted September 29, 2008 No problem, glad I could help. Link to comment https://forums.phpfreaks.com/topic/126313-solved-sending-an-email-with-mysql-data/#findComment-653203 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.