when you're pulling out your data, just put a <TR> or </TR> tag at the beginning and end of your loop.
Here's an example:
print '<Table>';
while ($result = mysql_fetch_row($stmt)) {
print '<Tr>';
for ($i = 0; $i < sizeof($result); $i++) {
print '<Td>'. $result[$i] .'</Td>';
}
print '</Tr>';
}
print '</Table>';
Is this what you mean?