Reputation: 95
I have an array in which 7 Id exist . I want to Fetch Record Of that ids In AND Operator My Query Is this
my array that Hold & ids is this $type_id
$query =("SELECT * FROM property Where Id ='".$id."' AND property_type='".$type_id."' ");
How This Query Execute That it Got all Records Of type_id
if Print_r($type-id);
Then result is
1,7,5,8,5,4,9
Any Suggetion And Help will Be appreciated
Upvotes: 0
Views: 81
Reputation: 6106
Not sure if I'm completely clear what you're asking but I think you need the IN operator, something like this:
"SELECT * FROM property
Where Id ='".$id."' AND
property_type IN (".implode(',',$type_id).") "
Upvotes: 0
Reputation: 1894
$type-id
is wrong variable in php so your result goes wrong use $type_id instead
Upvotes: 1