执行此代码时发生命令不同步错误。
foreach ($groupsId as $gpId) {
$stmt = $db->query("CALL addUserToGroup(?,?)", array($userId, $gpId));
$stmt->execute();
}
出现此错误
Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: Commands out of sync; you can't run this command now' in /var/www/html/zend/Zend/Db/Statement/Mysqli.php:77 Stack trace: #0
这是存储过程
DELIMITER //
CREATE PROCEDURE addUserToGroup(IN groupId INT(11),IN userId INT(11) )
BEGIN
insert into `group_users`(`group_id`,`user_id`) values(groupId ,userId );
END //
DELIMITER ;
我应该怎么办 ???