Zend Framework: Error in my database query syntax, please help!
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!
Are you sure $groupId is > 0?
精彩评论