Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

WHERE IN clause

Guys, why this returns me only first (1) record?

$types = '1,2,3';
$estateTypes = EstateType::find(array(
    'conditions' => 'id IN (?1)',
    'bind' => (array(1 => $types))
));

If I use it like this

$estateTypes = EstateType::find(array(
    'conditions' => 'id IN (1,2,3)'
));

it returns all records matched.



85.4k
Accepted
answer

Because a single value is being bound, this is the same as:

$estateTypes = EstateType::find(array(
    'conditions' => 'id IN ("1,2,3")'
));


11.9k

My mistake... Looks like it's too late for coding, gonna sleep a while :) Thanks @Phalcon