Ver Mensaje Individual
  #7 (permalink)  
Antiguo 01/04/2011, 06:46
Avatar de bUllan9ebrio
bUllan9ebrio
 
Fecha de Ingreso: enero-2011
Ubicación: Chile
Mensajes: 1.128
Antigüedad: 13 años, 3 meses
Puntos: 128
Respuesta: no me hace la consulta

Prueba con esto :

Código HTML:
Ver original
  1. <head><title> CONSULTA CITAS </title></head>
  2. <center><h2> citas del dia </h2><hr>
  3. <form action="cita4.php" method="post">
  4. <p> fecha <br>
  5.  
  6. <p>dia
  7. <input type="text" name="dia">
  8. </p>
  9. <p>
  10. <input type="submit" name="enviar" value="Enviar"></p>
  11. </form>
  12. </center>
  13. </body>
  14. </html>

y recoge los datos con esto:

Código PHP:
Ver original
  1. <?php
  2. $conexion=mysql_connect("localhost","root","1234") or die ('No pudo conectarse');
  3. mysql_select_db("can1",$conexion);
  4. $dia=$_POST['dia'];
  5. $sql="SELECT nombre, hora FROM citas WHERE dia = '$dia' ORDER BY hora ASC" ;
  6. $resul=mysql_query($sql);
  7. if(mysql_error($conexion)!=0)
  8. {
  9.     echo"<center><h2><p>ERROR AL REALIZAR LA SENTENCIA SELECT</center>";
  10.     exit();
  11. }
  12. $numero=mysql_num_rows($resul);
  13. if($numero==0)
  14. {
  15.     echo"<center><h2><p>NO EXISTE CIITAS PARA EL DIA : $dia</center></p>";
  16.     exit();
  17. }
  18. echo"<center><h2><p> LISTADO </p>
  19. <table width='500' border='1'>
  20. <tr><td><p> NOMBRE </p></td>
  21. <td><p> HORA </p></td>
  22. <td><p> EDAD </p></td>";
  23. // <td><p> EQUIPO </p></td>";
  24.  
  25. while($fila=mysql_fetch_array($resul)) {
  26. echo"<tr><td>$fila[nombre]</td>
  27. <td>$fila[hora]</td>
  28. <td>$dia</td>
  29. </tr>";
  30. }
  31. echo"</table></center>";
  32. mysql_close($conexion);
  33.  
  34. ?>

Saludos
__________________
Si no vivimos como pensamos, pronto empezaremos a pensar como vivimos.
Más vale un Gracias sincero, que un número que aumente "popularidad" ¬¬°

Universidad de chile, campeón