i am getting result in phpadmin for this query but getting error in php(You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
)
select * from luxury_properties LP,property_type PT,cities C
where (FIND_IN_SET('2',LP.luxury_property_feature_id) OR
FIND_IN_SET('7',LP.luxury_property_feature_id) )
AND LP.property_type_id = PT.property_type_id
AND LP.city=C.city_id
AND LP.status=1
order by LP.property_price DESC
Where LP.luxury_property_feature_id
is comma separated value
What is the issue in this query?
Updated:
I am executing like this
$str='';
if(is_array($luxPropFeatures) && $luxPropFeatures != 0)
{
$selCount = count($luxPropFeatures);
if($selCount >1){
foreach($luxPropFeatures as $val){
$str .= " OR FIND_IN_SET('".$val."',LP.luxury_property_feature_id) ";
$str[0]='';$str[1]='';
}
}else{
foreach($luxPropFeatures as $val) {
$str = " FIND_IN_SET('".$val."',LP.luxury_property_feature_id) ";
}
}
}
$sql = "select * from luxury_properties LP,property_type PT,cities C
WHERE (".$str.")
AND LP.property_type_id = PT.property_type_id
AND LP.city=C.city_id
AND LP.status=1
order by LP.property_price DESC";
Where $luxPropFeatures
is checkbox selected array