Código PHP:
$resultado = mysql_query("SELECT * FROM $db",$link);
$campos = @mysql_num_fields($resultado);
$registros = @mysql_num_rows($resultado);
$clave = $_GET['clave'];
if ($clave<>''){
{
$trozos=explode(" ",$clave);
$numero=count($trozos);
if ($numero==1)
{
$buscar="SELECT * FROM $db WHERE NOMB LIKE '%$clave%' OR AUTOR LIKE '%$clave%' OR TEMA LIKE '%$clave%' OR COLECCION LIKE '%$clave%' OR EDITORIAL LIKE '%$clave%' OR LIBRE LIKE '%$clave%' OR OBSERVA LIKE '%$clave%' order by $ordenarpor $orden";
}
elseif ($numero>1)
{
$buscar= "SELECT * , MATCH (NOMB, AUTOR, TEMA, COLECCION, EDITORIAL, LIBRE, OBSERVA) AGAINST ('$clave') AS Score FROM vells WHERE MATCH (NOMB, AUTOR, TEMA, COLECCION, EDITORIAL, LIBRE, OBSERVA) AGAINST ('$clave') ORDER BY Score DESC ";
}
}
}elseif (!$clave<>''){
$buscar = "SELECT * FROM $db WHERE AUTOR LIKE '%$AUTOR%' AND TEMA LIKE '%$TEMA%' AND LIBRE LIKE '%$LIBRE%' AND NOMB LIKE '%$NOMB%' OR TEMA LIKE '%$TEMA%' AND (AUTOR LIKE '%$AUTOR%' AND LIBRE LIKE '%$LIBRE%' AND NOMB LIKE '%$NOMB%') OR NOMB LIKE '%$NOMB%' AND (AUTOR LIKE '%$AUTOR%' AND LIBRE LIKE '%$LIBRE%' AND TEMA LIKE '%$TEMA%') order by $ordenarpor $orden";
}
$_pagi_sql=$buscar;
$_pagi_cuantos = $numerolibros;
$_pagi_nav_num_enlaces=5;
$_pagi_conteo_alternativo = 0;
$_pagi_propagar=array("db","clave","numerolibros","ordenarpor","orden","TEMA","NOMB","AUTOR","PVP","LIBRE");
include("../shared/includes/paginator.inc.php");
$result = @mysql_query($_pagi_sql);
while ($row=@mysql_fetch_row($result))
$number = @mysql_num_rows($result);
$_pagi_nav_estilo = "pagi";
?>