So i am trying to send confirmation of an order via email. To do this i need to attach the body as a variable which is $body
So i have all my html code inside the $body. That part works great and it emails successfully.
However i need to loop out what ever was ordered so the customer knows what they ordered and what they paid for each item.
So here is the SQL query
// GET THE PRODUCTS THAT HAVE BEEN ORDERED
$w="SELECT
nfw_order_new_items.name,
nfw_order_new_items.qty,
nfw_order_new_items.price
FROM
nfw_order_new_items
WHERE
nfw_order_new_items.id_order = '$order_ID'";
$ww= mysql_query("$w") or die("Inv Rows ".mysql_error());
Then the body as an example, has my html in it. The $name, $qty and $price are where i want my loop to create the rows of the table depending on how many in the result. I have tried putting the loop outside body like below, but that doesnt work either. See below:
while(list($name,$qty,$price)= mysql_fetch_row($ww)){
$body = "<table width=\"80%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr style=\"font-size:12px; font-weight:bold; color:#FFF\">
<td width=\"111\" bgcolor=\"#333333\" style=\"padding-left:5px;\">Product Name:</td>
<td width=\"290\" bgcolor=\"#333333\">QTY:</td>
<td width=\"67\" align=\"center\" bgcolor=\"#333333\">Price Each</td>
<td width=\"121\" align=\"right\" bgcolor=\"#333333\" style=\"padding-right:5px; font-size:12px; text-align:right;\">Total Price</td>
</tr>
<tr>
<td style=\"padding-left:5px; font-size:12px;\">$name</td>
<td style=\"padding-left:0px; font-size:12px;\">$qty</td>
<td style=\"padding-left:0px; font-size:12px; text-align:center;\">$price</td>
</tr>
</table>"; }