Jump to content

[SOLVED] Sending an Email with MySQL data


$username

Recommended Posts

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 = 'bjanzen@nextechworks.com';
$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
Share on other sites

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
Share on other sites

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
Share on other sites

$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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.