Ver Mensaje Individual
  #6 (permalink)  
Antiguo 16/01/2005, 19:48
kiewic
 
Fecha de Ingreso: abril-2004
Ubicación: Ciudad de México
Mensajes: 52
Antigüedad: 20 años, 1 mes
Puntos: 1
Ya Está

Gracias xknown por la ayuda. Aquí dejo el código final de mi duda, sirve para mostrar en una tabla-html una tabla de mysql completamente, independientemente del numero de campos o registros.

Código PHP:
$cnx conectar ();
$sql "SELECT * FROM tabla ORDER BY id DESC";
$resmysql_query($sql) or die (mysql_error());
echo 
"<table width='100%' border='0' cellpadding='5' cellspacing='0'>\n";
echo 
"<tr align='left' bgcolor='#FF6699'>\n";
// IMPRIME CAMPOS
$y=mysql_num_fields($res)-1;
for (
$x=0$x<=$y$x++) {
    echo  
"<td>".mysql_field_name($res$x)."</td>\n";
}
echo 
"</tr>\n";
// IMPRIME REGISTROS
while ($linea mysql_fetch_array($resMYSQL_ASSOC)) {
    echo 
"<tr valign='top' bgcolor='#f7f7f7'>\n";
    foreach (
$linea as $valor) {
        echo 
"<td>$valor</td>\n";
    }
    echo 
"</tr>\n";
}

echo 
"</table>\n";
mysql_free_result($res);
mysql_close($cnx);