i am using the following query:-
$qry=mysql_query("SELECT item,quantity,price,(quantity * price) as total FROM saleitems_T WHERE invoice = '$inv' ");
i am trying to use the while loop inside the mail body but it does not work. following is the code.
$to="someone@somewhere.com";
$headers="Content-type: text/html\r\n";
$body = '
<html> <body>
Invoice details are as follows.<br />
'.while($row = mysql_fetch_array($qry)){
echo "<table><tr><td>";
echo $row['item'];
echo "</td><td>";
echo $row['quantity'];
echo "</td><td>";
echo $row['price'];
echo "</td><td>";
echo $row['total'];
echo "</td></tr>";} .'
</table></body></html>';
mail($to,$body,$headers);
the no of lines retrieved varies on each invoice. Now i want to send the results as an email. any help with sample code would be greatly appreciated.
1 Answer