
$query .= " AND p.conteudo=" . $sql->quote ($conteudo);
// p.conteudo é o campo da tabela qe sera pesquisado (ex '2 3 5 7') e $conteudo e o numero que esta sendo pesquisado (ex. '2')

<?php } else if ( $cgi->getValue ( "op" ) == "search" ) { $pt = $cgi->getValue ( "pt" ); $pp = $cgi->getValue ( "pp" ); $pb = $cgi->getValue ( "pb" ); $pl = $cgi->getValue ( "pl" ); $po = $cgi->getValue ( "po" ); $pp_min = $cgi->getValue ( "pp_min" ); $pp_max = $cgi->getValue ( "pp_max" ); $conteudo = $cgi->getValue ("conteudo"); $query = " SELECT p.id AS id, p.propertyoption AS propertyoption, p.propertyprice AS propertyprice, p.propertyaddress AS propertyaddress, pl.propertylocation AS propertylocation, ps.propertystatus AS propertystatus, pt.propertytype AS propertytype, p.propertyref AS propertyref, p.propertybedrooms AS propertybedrooms, p.propertyphoto1 AS propertyphoto1, p.propertyphoto2 AS propertyphoto2, p.propertyphoto3 AS propertyphoto3, p.propertyphoto4 AS propertyphoto4, p.shortdescription AS shortdescription, p.longdescription AS longdescription, p.virtualtour AS virtualtour, p.conteudo AS conteudo FROM " . $property_table . " p INNER JOIN " . $propertytypes_table . " pt ON (p.propertytype=pt.id) INNER JOIN " . $propertylocations_table . " pl ON (p.propertylocation=pl.id) INNER JOIN " . $propertystatus_table . " ps ON (p.propertystatus=ps.id) WHERE p.propertyshow=1 "; if ( $pt != "" ) $query .= " AND p.propertytype=" . $sql->quote ( $pt ); if ( $pp_min != "" ) $query .= " AND p.propertyprice>=" . $sql->quote ( $pp_min ); if ( $pp_max != "" ) $query .= " AND p.propertyprice<=" . $sql->quote ( $pp_max ); if ( $pb != "" ) $query .= " AND p.propertybedrooms>=" . $sql->quote ( $pb ); if ( $pl != "" ) $query .= " AND p.propertylocation=" . $sql->quote ( $pl ); if ( $po != "" ) $query .= " AND p.propertyoption=" . $sql->quote ( $po ); if ( $conteudo != "" ) $query .= " AND p.conteudo=" . $sql->quote ($conteudo); // set the query ordering if ( isset ( $property_search_order ) && $property_search_order != "" ) $query .= "ORDER BY p." . $property_search_order . " " . ( "a" == strtolower ( substr ( $property_search_ordering, 0, 1 ) ) ? "ASC" : "DESC" ); $results = $sql->execute ( $query, SQL_RETURN_ASSOC ); $total_results = sizeof ( $results ); if ( $total_results == 0 ) { ?>