views:

101

answers:

1

I keep getting this error in my application and can't figure out what it means and where it's happening. I know it's in one of my models but I don't understand the error.

SQLSTATE[HY093]: Invalid parameter number: no parameters were bound

Have you ever run into this problem?

Update: I think I've narrowed it down to this code:

$db = Zend_Db_Table::getDefaultAdapter();
$select = new Zend_Db_Select($db);
$select->from('users')
    ->joinInner(
        'group_members',
        'users.id = group_members.user_id',
        array())
    ->where('group_members.group_id = ?', $groupId);
$result = $select->query();
$resultSet = $result->fetchAll();

Is there an error in my syntax?

Solution:

Turns out $groupId was never being set in the first place, so I was passing around a null variable.

->where('group_members.group_id = ?', $groupId); //$groupId was null!
A: 

Are you sure $groupId is > 0?

whichdan
turns out it was null!
Andrew