Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/05/2009, 03:43
Avatar de AnesGy
AnesGy
 
Fecha de Ingreso: mayo-2009
Mensajes: 518
Antigüedad: 15 años
Puntos: 19
Respuesta: Tablas dinamicas

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.