Re: Embedding HTML Within a PHP Statement [message #175991 is a reply to message #175983] |
Mon, 14 November 2011 13:07 |
Balazs Nadasdi
Messages: 7 Registered: November 2011
Karma:
|
Junior Member |
|
|
On Monday, November 14, 2011 11:10:15 AM UTC+1, Erwin Moller wrote:
> Have you never seen constructs like these before?
> <table>
> <tbody>
> <?php
> foreach ($someDBResult as $oneRow){
> ?>
> <tr>
> <td>
> <?php echo $oneRow["firstName"]; ?>
> </td>
> <td>
> <?php echo $oneRow["initials"]; ?>
> </td>
> </tr>
> <?php
> }
> ?>
> </tbody>
> </table>
more readable (i don't like this: <?php } ?>):
<table>
<tbody>
<?php foreach ($someDBResult as $oneRow): ?>
<tr>
<td>
<?=$oneRow["firstName"]; ?>
</td>
<td>
<?=$oneRow["initials"]; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
|
|
|