Output code inside PHP code

Good afternoon everyone. There is a table that is displayed in a loop

do { printf ("<table><tr><td>%s</td></tr></table>", $myrow["a"]); }
while ($myrow = mysql_fetch_array($result));

How to make the code output <table>first, then the loop, then </table>?

p.s. The lines themselves are displayed quietly. The catch is only with the output of table tags, before and after the do while construct. I tried it as standard, through echo, nothing happened.


Answer 1, authority 100%

echo '<table>';
do { echo "<tr><td>".$myrow["a"]."</td></tr>"; }
while ($myrow = mysql_fetch_array($result));
echo '</table>';

I don’t understand what’s wrong.

Added

$str = '<table>';
do { $str .= "<tr><td>".$myrow["a"]."</td></tr>"; }
while ($myrow = mysql_fetch_array($result));
$str. = '</table>';
echo $str;

Another option.