Buenas! Estoy usando el Paginator para paginar mis búsquedas y me va genial, pero ahora quiero aplicar unos filtros antes de realizar la búsqueda.
Será elegir una opción de 2 Select box y escribir en dos campos de texto (elegir provincia, introducir nombre, e-mail i elegir si el usuario está deshabilitado o no). 
He hecho lo siguiente:   
Código PHP:
Ver original- if ($_POST["SNAYprovincia"] <> 0) { 
-         if ($Condicion == "") { 
-             $Condicion = $Condicion ." WHERE clau_provincia = ". $_POST["SNAYprovincia"]; 
-         }else{ 
-             $Condicion = $Condicion ." AND clau_provincia = ". $_POST["SNAYprovincia"]; 
-         } 
-     } 
-     if (strlen($_POST["TNAYnom"]) > 0) { 
-         if ($Condicion == "") { 
-             $Condicion = $Condicion ." where (nom like '%". str_replace($_POST["TNAYnom"],"'","´") ."%' or cognom1 like '%". str_replace($_POST["TNAYnom"],"'","´") ."%' or cognom2 like '%". str_replace($_POST["TNAYnom"],"'","´") ."%')"; 
-         }else{ 
-             $Condicion = $Condicion &" and (nom like '%". str_replace($_POST["TNAYnom"],"'","´") ."%' or cognom1 like '%". str_replace($_POST["TNAYnom"],"'","´") &"%' or cognom2 like '%". str_replace($_POST["TNAYnom"],"'","´") ."%')"; 
-         } 
-     } 
-     if (strlen($_POST["TNAYmail"]) > 0) { 
-         if ($Condicion == "") { 
-             $Condicion = $Condicion ." where mail like '%". str_replace($_POST["TNAYmail"],"'","´") ."%'"; 
-         }else{ 
-             $Condicion = $Condicion ." and mail like '%". str_replace($_POST["TNAYmail"],"'","´") ."%'"; 
-         } 
-     } 
-     if (strlen($_POST["SNAYdeshabilitat"]) > 0 ){ 
-         if (clng($_POST["SNAYdeshabilitat"]) == 1) { 
-             if ($Condicion == "") { 
-                 $Condicion = $Condicion ." where deshabilitat = true"; 
-             }else{ 
-                 $Condicion = $Condicion ." and deshabilitat = true"; 
-             } 
-         }else{ 
-             if ($Condicion == "") { 
-                 $Condicion = $Condicion ." where deshabilitat = false"; 
-             }else{ 
-                 $Condicion = $Condicion ." and deshabilitat = false"; 
-             } 
-         } 
-     } 
Y luego en la consulta: 
"SELECT * FROM usuaris '".$Condicion."'" 
pero me da error de syntaxis. Como lo véis?