Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/05/2010, 10:30
Avatar de wiwi74
wiwi74
 
Fecha de Ingreso: marzo-2008
Mensajes: 515
Antigüedad: 16 años, 1 mes
Puntos: 10
Respuesta: imprimir wile en tablas horizontalmente?

Prueba este codigo, es php faltaria al coneccin a db



<table border="1" cellpadding="5" cellspacing="0">

<?php

//CONEXXION

$sql = "SELECT * FROM ".$TABLE.";";

$query_columms=mysql_query("SHOW COLUMNS FROM ".$TABLE."");

echo "<tr style='background-color:#CCCCCC;'>";
while($field=mysql_fetch_array($query_columms)){
echo "<td>".$field['Field']."</td>";
}
echo "</tr>";

$res = mysql_query($sql)or die(mysql_error());

while ($fila = mysql_fetch_array($res)){


//AQUI LE DAS A $fila[] LOS NOMBRES DE LOS CAMPOS QUE HAYA EN TU TABLA
//Y SIEMPRE EL EL ULTIMO ECHO CIERRAS CON <TR>
//(En mi caso habia tres. Hay modos de hacerlo dinamico pero en otro capitulo)
echo "<tr><td>".$fila['id']."</td>";
echo "<td>".$fila['estado']."</td>";
echo "<td>".$fila['relacion']."</td></tr>";

}

?>

</table>

Última edición por wiwi74; 26/05/2010 a las 10:37