I am trying to combine html and php to get a function.
<?php
function display_text()
{
$handle_text = '
<div class="container">'.
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
extract($row); .'
<div class="row">
<div class="col-2">
</div>
<div class="col-9">
'. echo $row['body']; .'
</div>
</div> '.
} .'
</div>';
return $handle_text ;
}
?>
However I get an error Parse error: syntax error, unexpected 'while' (T_WHILE) in C:\wamp64
.
How could I manage it? Thank you in advance.