Adjunto el enlace del funcionamiento de la pàgina:
(incluir_inicio_web)alberic(punto)com/persones/buscapersones(punto)html
Para ver mejor el resultado hay que poner Sergi en el campo “Nom”
Aquí dejo el código de la pàgina que recoge el formulario y de parte del script (la otra parte la dejo en otro mensaje pues és muy largo):
Código formulario:
Ver original
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Busca persones</title> <link href="estil.css" rel="stylesheet" type="text/css" /> </head> <body bgcolor="#CCCCCC" > <span class="Estilo1"></span> <h2> RESULTATS DE LA BÚSQUEDA</h2> <? $host= 'xxx'; //$user = 'xxx'; $user = 'xxx'; $password = 'xxx'; $db = 'xxx'; $enllac = mysql_connect ($host,$user,$password); mysql_select_db($db,$enllac); $consulta = mysql_query("SELECT * FROM collaboradors WHERE Nom LIKE '%$Nom%' and Cognoms LIKE '%$Cognoms%' and Adreca LIKE '%$Adreca%' and Codi_postal LIKE '%$Codi_postal%' and Poblacio LIKE '%$Poblacio%' and Provincia LIKE '%$Provincia%' and CIF LIKE '%$CIF%' and Telefon LIKE '%$Telefon%' and Mobil LIKE '%$Mobil%' and e_mail LIKE '%$e_mail%' and web LIKE '%$web%'"); while($row = mysql_fetch_array($consulta)){ $id=$row["id"]; $Nom=$row["Nom"]; $Cognoms=$row["Cognoms"]; $Adreca=$row["Adreca"]; $Codi_postal=$row["Codi_postal"]; $Poblacio=$row["Poblacio"]; $Provincia=$row["Provincia"]; $CIF=$row["CIF"]; $Telefon=$row["Telefon"]; $Mobil=$row["Mobil"]; $e_mail=$row["e_mail"]; $web=$row["web"]; echo("<table width='80%' align='center' border='0' cellspacing='0' cellpading='0'>\n"); echo("<tr>\n"); echo("<td width='10%'><a href=pagaments/index_pagaments.php?id=$id> Pagar </a></td>\n"); echo("<td width='10%'><a href=modificarpersona.php?id=$id> Modificar </a></td>\n"); echo("<td width='10%'><a href=borrarpersona.php?id=$id> Borrar </a></td>\n"); echo("<td width='10%'>$Nom</a></td>\n"); echo("<td width='10%'>$Cognoms</a></td>\n"); echo("<td width='15%'>$Adreca</a></td>\n"); echo("<td width='5%'>$Codi_postal</a></td>\n"); echo("<td width='15%'>$Poblacio</a></td>\n"); echo("<td width='5%'>$Provincia</a></td>\n"); echo("<td width='5%'>$CIF</a></td>\n"); echo("<td width='5%'>$Telefon</a></td>\n"); echo("</tr>\n"); echo("</table>\n"); echo"<hr size=2 color=ffffff width=100% align=left>";} include("Paginator/demo.php"); ?> </body> </html>
Código demo:
Ver original
<?php //Conexión a la base de datos $con = mysql_connect("xxx","xxx","xxx") or die (mysql_error()); mysql_select_db("xxx",$con) or die (mysql_error()); //Sentencia sql (sin limit) $_pagi_sql = "SELECT * FROM collaboradors WHERE Nom LIKE '%$Nom%' and Cognoms LIKE '%$Cognoms%' and Adreca LIKE '%$Adreca%' and Codi_postal LIKE '%$Codi_postal%' and Poblacio LIKE '%$Poblacio%' and Provincia LIKE '%$Provincia%' and CIF LIKE '%$CIF%' and Telefon LIKE '%$Telefon%' and Mobil LIKE '%$Mobil%' and e_mail LIKE '%$e_mail%' and web LIKE '%$web%'"; //cantidad de resultados por página (opcional, por defecto 20) $_pagi_cuantos = 3; //cantidad de enlaces que se mostrarán como máximo en la barra de navegación $_pagi_nav_num_enlaces = 3;//Elegí un número pequeño para que se note el resultado //Incluimos el script de paginación. Éste ya ejecuta la consulta automáticamente include("paginator.inc.php"); //Leemos y escribimos los registros de la página actual while($row = mysql_fetch_array($_pagi_result)){ echo $row['pkID']."<br />"; } //Incluimos la barra de navegación echo"<p>".$_pagi_navegacion."</p>"; ?>
Muchas gracias por todo.