codice:
<table>
<?
$riga1="<tr><td>Nome:</td>";
$riga2="<tr><td>Cognome:</td>";

while($row = mysql_fetch_array($query)){
   $nome = $row['nome'];
   $cognome = $row['cognome'];

$riga1.="<td>".$nome."</td>";
$riga2.="<td>".$cognome."</td>";
}
echo $riga1."</tr>";
echo $riga2."</tr>";
?>

</table>