When posting PHP code, please use the board's [noparse]
[/noparse] BBcode tags as they make your code much easier to read and analyze.
As for your problem, I think what you're looking for is something like this:
<?php
if(condition) {
?>
<!-- bunch of HTML code here -->
<?php
} else {
?>
<!-- more HTML code here -->
<?php
}
// rest of PHP code
As you can see, there's no "do" command - just escape out of the PHP tags and insert the HTML code inside the if() statement.
Note, however, how messy this looks and hard it is to "read" the code; this is why I've always recommended separating PHP from HTML. Using template files is a great way to do this, as it could simplify your code down to:
if(condition)
include('table.inc');
else
include('no_data.inc');
There are, of course, many other methods of templating - there are even entire templating packages out there (ex. Smarty).