Código PHP:
$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'IN BOOLEAN MODE) AS Score FROM $db WHERE MATCH (NOMB, AUTOR, TEMA, COLECCION, EDITORIAL, LIBRE, OBSERVA) AGAINST ('$clave' IN
BOOLEAN MODE) ORDER BY Score DESC ";
}
}
}elseif (!$clave<>''){
$buscar = "SELECT * FROM $db WHERE NOMB LIKE '%$NOMB%' AND AUTOR LIKE '%$AUTOR%' AND TEMA LIKE '%$TEMA%' AND EDITORIAL LIKE '%$EDITORIAL%' OR TEMA LIKE '%$TEMA%' AND (AUTOR LIKE '%$AUTOR%' AND EDITORIAL LIKE '%$EDITORIAL%' AND NOMB LIKE '%$NOMB%') OR NOMB LIKE '%$NOMB%' AND (AUTOR LIKE '%$AUTOR%' AND EDITORIAL LIKE '%$EDITORIAL%' AND TEMA LIKE '%$TEMA%') order by $ordenarpor $orden";
}