0
我试图发送电子邮件内的数组数据,无法让这个东西工作。 这里是确切的代码。在电子邮件内发送mysql提取的阵列数据
$c = mysql_query("SELECT item,qty,price,uom FROM saleitems WHERE saleinvid = '222384' ");
$to = "[email protected]";
$subject = "Invoice from company";
$headers = "Content-type: text/html\r\n";
$message = 'Greetings,
you are receiving this email as an invoice as follows:
<table border="1">
<tr>
<td>Description</td>
<td>Quantity</td>
<td>Price</td>
<td>UOM</td>
</tr>
';
while ($row = mysql_fetch_array($c)){
$message .="<tr>";
$message .="<td>".$row['item']."</td>";
$message .="<td>".$row['qty']."</td>";
$message .="<td>".$row['price']."</td>";
$message .="<td>".$row['uom']."</td>";
$message .="</tr>";
}
$message .="</table>Thank You,COMPANY";
mail($to,$subject,$message,$headers);
邮件被发送,但我看到的是表头行和“谢谢你,公司”行,但之间没有项目。任何帮助是极大的赞赏。 我的电子邮件提供商支持HTML邮件
您确定您的电子邮件提供商支持html吗? – Iordanis
首先,从代码中删除“打印”电话。 – hindmost
请检查您的查询中返回的行数错误,然后返回此处并打印结果。 – crafter