Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/02/2013, 10:38
botxii
 
Fecha de Ingreso: octubre-2012
Mensajes: 135
Antigüedad: 11 años, 6 meses
Puntos: 8
Pregunta Búsqueda php automatico (autocompletado)

Saludos, necesito ayuda para una web. Este código muestra los productos de una BD. Quiero que aparezca un <input> y que cuando escriba el producto se busque inmediatamente.

Saludos.

Código PHP:
Ver original
  1. <?php
  2.  
  3. if ($_SESSION["validation"]){}else{header("Location: ../index.php");}
  4.  
  5. ?>
  6.  
  7.  
  8. <html>
  9.  
  10.  
  11.  
  12. <html>
  13.  
  14. <--!CODIGO HTML
  15.     <?php
  16.  
  17.  
  18.  
  19. define('DB_SERVER1','localhost');
  20. define('DB_NAME1','ar');
  21. define('DB_USER1','root');
  22. define('DB_PASS1','c1e9s9a7r');
  23.  
  24. $con = mysql_connect(DB_SERVER1,DB_USER1,DB_PASS1);
  25. mysql_select_db(DB_NAME1,$con);
  26.  
  27.     echo"
  28.    <table border=1>
  29. <tr>
  30. <td>Ref</td>
  31. <td>Nombre</td>
  32. <td>Descripción</td>
  33. <td>Precio</td>
  34. </tr>
  35. ";
  36. $tabla = mysql_query("SELECT * FROM productos"); // selecciono todos los registros de la tabla usuarios, ordenado por nombre
  37.  
  38.  
  39.  
  40. while ($registro = mysql_fetch_array($tabla)) {
  41.  
  42.  
  43. if($registro['ref'] == ""){}else{
  44. echo"<tr>";
  45.  
  46.                        echo "<td>".$registro['ref']."</td>";
  47.                        echo"<td> ".$registro['nombre']."</td>";
  48.                        echo "<td>".$registro['descripcion']."</td>";
  49.                        echo "<td>".$registro['precio']."€</td>";
  50.                        
  51.                        
  52. echo"</tr>";
  53. }
  54.  
  55.  
  56. }
  57.  
  58.  
  59. echo"
  60. </table>";
  61.  
  62. ?>
  63.    
  64.    
  65.     </td>
  66.     <td width=10></td>
  67.     <td width=124 align=center valign="top">
  68.     <!--LATERAL DERECHO-->
  69.    
  70.    
  71.     </td>
  72.  
  73. </table>
  74.  
  75. </body>
  76. </html>