Commands out of sync Error occur when executing this code.
foreach ($groupsId as $gpId) {
            $stmt = $db->query("CALL addUserToGroup(?,?)", array($userId, $gpId));
        $stmt->execute();
 }
This error occur
 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 
here's the stored procedure
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 ;
What should I do ???
 
    