Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/07/2015, 19:05
Avatar de xfxstudios
xfxstudios
 
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: No puedo mostrar los datos desde mysql en una tabla

Código PHP:
Ver original
  1. <?php
  2. require_once('conexion.php');
  3. $search = '';
  4. if (isset($_POST['search'])){
  5.     $search = $_POST['search'];
  6. }
  7. $consulta = "SELECT * FROM alumnos WHERE nombre = '$search' ;
  8. $resultado = $conexion->query($consulta);
  9. ?>
  10.  
  11. <?php if ($resultado>0 && $search!='') {?>
  12. <h2>REGISTROS</h2>
  13. <?php  
  14. echo "<table>";  
  15. echo "<tr>";  
  16. echo "<th>Nombre</th>";  
  17. echo "<th>edad</th>";  
  18. echo "<th>Pais</th>";  
  19. echo "</tr>";  
  20. while ($fila = mysql_fetch_array($resultado)){    
  21.     echo "<tr>";  
  22.     echo "<td>$fila['nombre']</td>";  
  23.     echo "<td>$fila['apellido']</td>";  
  24.     echo "<td>$fila['nit']</td>";  
  25.     echo "</tr>";  
  26. }
  27.  echo "</table>"; ?>
  28. <?php } ?>
prueba asi