【发布时间】:2014-03-26 06:01:19
【问题描述】:
在我的代码中,我想包含 while 循环以从数据库中获取信息并以表格形式将其发送给用户。 我试图搜索大量文章,但实际上没有任何解决方案对我有用。 这是我的代码:
$message->setBody('
<html>
<body>
<table style="margin-top:10px; width: 680px; border:0px;">
<tr>
<th width="80%">Product Details</th>
<th width="20%">Amount</th>
</tr>'); /* This is Line 43 */
while ($row = mysql_fetch_array($results2)){
$message->setBody .= ('<tr>
<th width="80%">'.$row["product_name"].' - '.
$row["quantity"].' '.$row["type"].'</th>
<th width="20%">₹ '.$row["subtotal"].'</th>
</tr>');
}
$message->setBody .= ('</table>
</body>
</html>',
'text/html');
随之而来的错误是:
Parse error: syntax error, unexpected ';' in /home/public_html/example.com/
test.php on line 43
我知道我一定遗漏了一些基本但无法找到的东西。任何帮助将不胜感激。
编辑
while 循环的结果很好(在电子邮件外部测试),所以这不是问题。
上一部分有错误
$message->setBody .= ("</table>
</body>
</html>",
'text/html');
错误是“'Unexpected ',' in file at line no. 62”。
【问题讨论】:
标签: php email swiftmailer