It is inefficient to create/reassign variables needlessly. You are better off without the $output stuff:
$result = mysql_query("SELECT * FROM table_name");
if( mysql_num_rows($result) == 0 )
{ ehco("There is no data to display"); }
else
{
echo("
<table>
<tr>
<td>first name</td>
<td>last name</td>
</tr>
");
while( $row = mysql_fetch_array($result) )
{
echo("
<tr>
<td>$row[first_name]</td>
<td>$row[last_name]</td>
</tr>
");
}
echo("</table>");
}
That displays each person in a different row, within the same table. There are gobs of tutorials on this. check out webmonkey and sitepoint.