Ver Mensaje Individual
  #6 (permalink)  
Antiguo 17/09/2012, 08:44
pablo_exeg
 
Fecha de Ingreso: septiembre-2012
Ubicación: Argentina
Mensajes: 144
Antigüedad: 11 años, 7 meses
Puntos: 12
Respuesta: Extraer registros de tabla html a php

Aca te dejo un ejemplo

Código PHP:
Ver original
  1. <html>
  2.  
  3. <body>
  4.  
  5. <?php
  6.  
  7. $link = mysql_connect("localhost", "root", "xxxxxx");
  8.  
  9. mysql_select_db("mibasededatos", $link); //pone el nombre de la base de datos
  10.  
  11. $result = mysql_query("SELECT nombre, email FROM agenda", $link);
  12.  
  13. if ($row = mysql_fetch_array($result)){
  14.  
  15. echo "<table border = '1'> \n";
  16.  
  17. echo "<tr> \n";
  18.  
  19. echo "<td><b>Nombre</b></td> \n";
  20.  
  21. echo "<td><b>E-Mail</b></td> \n";
  22.  
  23. echo "</tr> \n";
  24.  
  25. do {
  26.  
  27. echo "<tr> \n";
  28.  
  29. echo "<td>".$row["nombre"]."</td> \n";
  30.  
  31. echo "<td>".$row["email"]."</td>\n";
  32.  
  33. echo "</tr> \n";
  34.  
  35. } while ($row = mysql_fetch_array($result));
  36.  
  37. echo "</table> style="margin-left: 50">echo "</table> \n";
  38.  
  39. } else {
  40.  
  41. echo "¡ La base de datos está vacia !";
  42.  
  43. }
  44.  
  45. ?>
  46.  
  47. </body>
  48.  
  49. </html>



hay esta un ejemplo donde hace una consulta de nombre email de la tabla agenda y la muestra en una tabla segun el resultado de la consulta