In my code, I want to include while loop to fetch info from DB & send it in a table form to user. I tried to search numerous articles but no solutions worked for me actually. Here's my code:
$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');
Error that is coming with this is:
Parse error: syntax error, unexpected ';' in /home/public_html/example.com/
test.php on line 43
I know I must be missing something basic but not able to find out. Any help will be appreciated.
EDIT
Results are coming fine from while loop (tested outside email), so that can not be the issue.
ERROR IN LAST PART
$message->setBody .= ("</table>
</body>
</html>",
'text/html');
Error is " 'Unexpected ',' in file at line no. 62 ".