Ya hecha la llamada a
mysql_query y almacenada en
$result:
Código PHP:
echo "<table>\n";
$noheader = true;
while($row = mysql_fetch_assoc($result)){
echo "<tr>\n";
if($noheader){
foreach($row as $key=>$value){
echo "<th>$key<th>\n";
}
echo "</tr>\n<tr>";
$noheader = false;
}
foreach($row as $key=>$value){
echo"<td>$value</td>\n";
}
echo "</tr>\n";
}
echo "</table>";
Muestra el cabecero con los nombres de columna y luego los registros.