I'm not really sure what you're trying to do. If you want the error to display in the middle of the page, put the PHP in the middle of the page:
<html>
<morehtml>
<?php
$sql = mysql_connect($server,$username,$password);
mysql_select_db($db);
$result = mysql_query($query);
if (mysql_num_rows($result) >= 1) {
// there're some results, maybe only 1
while ($results = mysql_fetch_array($result, MYSQL_NUM)) {
print_r($results);
}
}
else {
// no results
echo("Sorry, there were no results.");
}
?>
</morehtml>
</html>
This will print out the array from the DB using print_r and mysql_fetch_array if there were results, or print out the error if there weren't results.
Obviously, you'll have to change it to your likings.