I'm processing information from a database in php, and intend to set values in a html code block:
$var = [function to grab multiple rows from database]($args);
foreach ($var as $row) {
echo "<p>$row[username]</p>";
}
The problem is the code in that echo statement isn't a simple <p></p>
, but about 50 lines of html. Is it possible to close the php tags in the middle of the foreach loop, like so:
$var = [function to grab multiple rows from database]($args);
foreach ($var as $row) {
?>
<p> <?php echo "$row[username]";?> </p>
<?php
}
?>
And if not, what do you suggest?