Problem with a query

Robust

Well-known member
Code:
        $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:
Code:
WHERE group_id IN (' . $this->_getDb()->quote($groups) . ')
 
Top Bottom