Echoing a while loop within an echo
Posted: Tue Jul 20, 2010 4:34 pm
I have a table that is using while to show repeating results. The table is shown inside an echo, and I am having trouble getting it to work without error. I get:
Parse error: syntax error, unexpected '}' in C:\wamp\www\polaris\index.php on line 144
I am not sure why the } is unexpected.
Parse error: syntax error, unexpected '}' in C:\wamp\www\polaris\index.php on line 144
I am not sure why the } is unexpected.
Code: Select all
<?php if (isset($_POST['submit_search_polaris'])) {
echo '
<table class="data">
<tr>
<th><div align="left">Name</div></th>
<th><div align="left">Birthdate</div></th>
<th><div align="left">Gender</div></th>
<th><div align="left">Phone Number</div></th>
<th><div align="left">Barcode</div></th>
</tr>
'; do { '
<tr onmouseover="this.bgColor=#EBFAFF;" onmouseout="this.bgColor=#FFFFFF;">
<td>$PatronFullName</td>
<td>$Birthdate</td>
<td>$Gender</td>
<td>$PhoneVoice1</td>
<td>$Barcode</td>
</tr>
' } while ($row = mssql_fetch_assoc($result)); '
</table>
';
}
?>