Ver Mensaje Individual
  #8 (permalink)  
Antiguo 19/05/2004, 18:19
kike666
 
Fecha de Ingreso: mayo-2004
Ubicación: Ocotlan
Mensajes: 27
Antigüedad: 22 años, 4 meses
Puntos: 0
Ya esta y quedo asi.....

buscador.html

Código PHP:
<html> 
<
body> 
<
form method="POST" action="buscador.php"> 
<
strong>Palabra clave:</strong> <input type="text" name="buscar" size="20"><br><br> 
<
input type="submit" value="Buscar" name="buscar"><br> 
</
form> 
</
body> 
</
html> 
Buscador.php

Código PHP:
<html> 
<body> 
  
<?php 
if ($_POST['buscar'] = ""){ 
      echo 
"Debe especificar una cadena a buscar"; 
      echo 
"</html></body> \n"; 
      exit; 
} 
$link = mysql_connect("localhost", "root", ""); 
mysql_select_db("prueba", $link); 
$result = mysql_query("SELECT * FROM alumnos WHERE nombre LIKE '%$buscar%' ORDER BY nombre", $link);
if (
$row = mysql_fetch_array($result)){
      echo 
"<table border = '1'> \n"; 
//Mostramos los nombres de las tablas 
echo "<tr> \n"; 
while (
$field = mysql_fetch_field($result)){ 
            echo 
"<td>$field->name</td> \n"; 
} 
      echo 
"</tr> \n"; 
do { 
            echo 
"<tr> \n"; 
            
//echo "<td>".$row["id"]."</td> \n"; 
            
echo "<td>".$row["nombre"]."</td> \n"; 
            echo 
"<td>".$row["especialidad"]."</td> \n"; 
            echo 
"<td>".$row["turno"]."</td> \n"; 
            
//echo "<td><a href='mailto:".$row["email"]."'>".$row["email"]."</a></td> \n"; 
            
echo "</tr> \n"; 
      } while (
$row = mysql_fetch_array($result)); 
            echo 
"</table> \n"; 
} else { 
echo 
"¡ No se ha encontrado ningún registro !"; 
} 
?> 
  
</body> 
</html>