no entanto não sou egoísta e vou postar a resolução para pessoas com as mesmas dificuldades que eu tive
<UPDATED 4
ao segundo dia, SOLVED 2
UPDATED>
////////////////////// //value "-1" ignores "WHERE" and "AND" //data passed by $_POST[]; //for it test only $tipo1 = "-1"; //$_POST[]; $negocio1 = "-1"; //$_POST[]; $imove1l = "-1"; //$_POST[]; $distrito1 = "-1"; //$_POST[]; $concelhos1 = "-1"; //$_POST[]; ////////////////////// mysql_select_db($database_conn_bd, $conn_bd); $query_rsJoin = "SELECT * FROM t_imoveis LEFT OUTER JOIN t_tipologia ON (t_imoveis.tipologia_id = t_tipologia.tid) LEFT OUTER JOIN t_negocio ON (t_imoveis.negocio_id = t_negocio.nid) LEFT OUTER JOIN t_imoveltipo ON (t_imoveis.imovel_id = t_imoveltipo.iid) LEFT OUTER JOIN t_distritos ON (t_imoveis.distrito_id = t_distritos.did) LEFT OUTER JOIN t_concelhos ON (t_imoveis.concelhos_id = t_concelhos.cid) "; $where = array(); if ($tipo1 != '-1') { $where[] = "t_imoveis.tipologia_id = '$tipo1' "; } if ($negocio1 != '-1') { $where[] = "t_imoveis.negocio_id = '$negocio1' "; } if ($imove1l != '-1') { $where[] = "t_imoveis.imovel_id = '$imove1l' "; } if ($distrito1 != '-1') { $where[] = "t_imoveis.distrito_id = '$distrito1'"; } if ($concelhos1 != '-1') { $where[] = "t_imoveis.concelhos_id = '$concelhos1'"; } $query_rsJoin .= (count($where) >0) ? "WHERE " . implode(" AND ", $where) : ""; $rsJoin = mysql_query($query_rsJoin, $conn_bd) or die(mysql_error()); $row_rsJoin = mysql_fetch_assoc($rsJoin); $totalRows_rsJoin = mysql_num_rows($rsJoin);
um abraço a todos