Ver Mensaje Individual
  #6 (permalink)  
Antiguo 11/04/2016, 08:52
Avatar de gnzsoloyo
gnzsoloyo
Moderador criollo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Actualmente en Buenos Aires (el enemigo ancestral)
Mensajes: 23.324
Antigüedad: 17 años, 3 meses
Puntos: 2658
Respuesta: Listar con PHP desde Base de datos

Código PHP:
Ver original
  1. $query = "select * from $table_name;";
  2.             if ($result = mysqli_query($db_link, $query)){
  3.  
  4.                 echo "<table>";
  5.                 //header
  6.                 echo "<tr><td>Date Added</td>";
  7.                         echo "<td>Name</td>";
  8.                         echo "<td>Email</td>";
  9.                 echo "<td>Gender</td>";
  10.                             echo "<td>Country</td>";
  11.                 echo "<td>Subject</td>";
  12.                         echo "<td>Comment</td>";
  13.                 echo "<td>Subscription</td></tr>";
  14.                     //data  
  15.                      while ($row = mysqli_fetch_array($result))  {
  16.                       echo "<tr><td>{$row[0]}</td>";
  17.                       echo "<td>{$row[1]}</td>";
  18.                       echo "<td>{$row[2]}</td>";
  19.                       echo "<td>{$row[3]}</td>";
  20.                       echo "<td>{$row[4]}</td>";
  21.                       echo "<td>{$row[5]}</td>";
  22.                       echo "<td>{$row[6]}</td>";
  23.                       echo "<td>{$row[7]}</td></tr>";
  24.                     }
  25.  
  26.                     echo "</table>";
  27.             }
  28.  
  29.             mysqli_free_result($result);
  30.             mysqli_close($db_link);

Ejemplo hurtado de StackOverflow...

Son cosas que encuentras en los tutriales.
__________________
¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...
"El problema es la interfase silla-teclado." (Gillermo Luque)