• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Problem with a query


Well-known member
        $groupPairs = $this->_getDb()->fetchPairs('
        SELECT group_id, group_name
        FROM apms2_group
        WHERE group_id IN (?)
        ', $groups);
This returns the first pair only.

$groups is '1,2'

If I replace IN (?) with IN (1,2) (for testing) it works properly and fetches multiple pairs. But if I use a prepared statement ($groups is also 1,2) it returns the first value only.

I've tried Zend_Debug::dump to ensure $groups is correct, it is.

Also doesn't work with:
WHERE group_id IN (' . $this->_getDb()->quote($groups) . ')