When I submit just one term to the search system, the search condition 'aprovar' = '1' is ignored. But when I submit two or more words, this same condition is respected. . Take a look at my code and see if you find any error, please! I put an echo before mysql runs, and I got: select id,Nombre,Imagen,Visitas,Votantes,Puntos,Categoria,Thumb from neww WHERE Aprobar = '1' and Nombre LIKE '%word%' OR Categoria LIKE '%word%' OR Descripcion LIKE '%word%' OR Etiquetas LIKE '%word%' order by Visitas desc limit 0,32 It should work and show only results with Aprobar='1', but it show also results with Aprobar='0' !! Please, help me! Thanks function Ordenar_Columna_LIKE(){ if(count($this->Listado) == 0){ $this->Seleccion_Campos = "WHERE Aprovar = '1' and "; } else { $this->Selecao_Campos = "WHERE Aprovar = '1' and "; foreach($this->Listado as $valor){ $this->Selecao_Campos .= $valor." LIKE '%" . $this->Ablucion($this->Busqueda) . "%' OR "; } } return substr($this->Selecao_Campos,0,-4); function Consulta_LIKE(){ if(!eregi("^[0-9]+$",$this->MostrarResultados)) { $this->MostrarResultados = '10'; } $this->Consulta = "select " . $this->Selecao . " from " . $this->TabeladeBusca . " "; $this->Consulta .= "" . $this->Ordenar_Columna_LIKE() . " "; $this->Consulta .= " order by Visitas desc limit " . $this->PaginaInicial() . "," . $this->MostrarResultados . ""; return($this->Consulta); PHP:
try Aprobar = '1' and (Nombre LIKE '%word%' OR Categoria LIKE '%word%' OR Descripcion LIKE '%word%' OR Etiquetas LIKE '%word%')