Using the zend framework i have used a query,having a IN clause,this is my query
$select->where('p.brandid IN (?)',$details[brand]);
in the above query, $details[brand] has a value like this array(1,2,3) .
Actually the query has to return all the values which are all related to this array(1,2,3).
But my query is returning the result related to the first value present in the above array(1,2,3).ie 1 alone other 2,3 is not considered.
when i print this query it shows like this
[where] => Array
(
[0] => (p.brandid IN ('1,2,3'))
)
Can anyone show me what is the mistake i have made or solution for this..
This is because your query is getting formed wrongly p.brandid IN ('1,2,3')
instead of p.brandid IN (1,2,3)
you can try using implode function in php
$select->where('p.brandid IN (?)',implode(",",$details[brand]));