Ver Mensaje Individual
  #8 (permalink)  
Antiguo 09/06/2003, 01:31
Avatar de nuevo
nuevo
 
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 20 años, 11 meses
Puntos: 2
formulario:

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

y el php:

<html>
<body>

<?
if (!isset($buscar)){
echo "Debe especificar una cadena a bucar";
echo "</html></body> \n";
exit;
}
$link = mysql_connect("localhost","root","0");
mysql_select_db("shadow_post", $link);
$result = mysql_query("SELECT * FROM usuarios WHERE nick LIKE '%$buscar%' ORDER BY nick", $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["postdate"]."</td> \n";
echo "<td>".$row["postip "]."</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>

Última edición por nuevo; 09/06/2003 a las 02:52