Gracias Shakaran.
si Ok, va tu opcion está bien. entiendo.
Pero que hay cuando el usuario selecciona por ejemplo 4 campos????
El puede seleccionar 4 de los 13, los que el quiera, mi problema es este mira:
si selecciona el sexo:
if($_GET["sexo"]!="0")
{
$query .= " genero='".$_GET["sexo"]."' ";
}
y selecciona el idioma:
if($_GET["idioma"]!="0")
{
$query .= " and (hab_idioma1='".$_GET["idioma"]."' or hab_idioma2='".$_GET["idioma"]."') ";
}
y selecciona el nivel del idioma:
if($_GET["nivel_idioma"]!="0")
{
$query .= "and ( hab_idioma_nivel1='".$_GET["nivel_idioma"]."' or hab_idioma_nivel2='".$_GET["nivel_idioma"]."' ) ";
}
TENDRIA LO SIGUIENTE:
$query="genero='m' and (hab_idioma1='ingles' or hab_idioma2='ingles') and ( hab_idioma_nivel1='intermedio' or hab_idioma_nivel2='intermedio' )";
vaya, siguiendo con este ejemplo:
Si
SOLAMENTE selecciona el IDIOMA y EL NIVEL DEL IDIOMA:
Según los valores anteriores, tendria lo siguiente:
$query="and (hab_idioma1='".$_GET["idioma"]."' or hab_idioma2='".$_GET["idioma"]."')";
seria asi $res="select * from tabla_nombre ".$query." ";
si lo escribo con echo tengo esto:
"select * from tabla_nombre
where and (hab_idioma1='".$_GET["idioma"]."' or hab_idioma2='".$_GET["idioma"]."';
Si te fijas es incorrecto, porque la clave sería
WHERE hab_idioma1='".$_GET["idioma"]."' or hab_idioma2='".$_GET["idioma"]
y este problema me sucede con 4 campos!!!!!!
Y si selecciona 8 de los 13 campos totales???
Me entiendes mi problema?