HY000 - 2014 - Cannot execute queries while other unbuffered queries are active

懵懂的女人 提交于 2019-12-12 06:09:43

问题


Statement could not be executed (HY000 - 2014 - Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED i got this error while running an action in zf2, how to solve this issue

{ $assSub=$this->getTblInstitutesDepartmentsTable()->getAssignedDetails($urlassId);

$request = $this->getRequest();

    if($request->isPost()){
       $submittedArray = $request->getPost()->toArray();
       $remarks = $submittedArray['remark'];
       $grades  = $submittedArray['grade'];
       $submittedChk =$submittedArray['submitted'];      
       foreach ($submittedChk as $submitted){ 
             $chksubmitted = 1;                 
             $remark = $remarks[$submitted];    
             $grade  = $grades[$submitted];
                $submittedObj =  new TblInstitutesDepartmentModel(array('asid' => $sub,'gd_id' => $grd,'rem' => $rem,'is_sub' => $chksub,'sub_date'=>date('Y-m-d')));                    
                $this->getTblInstitutesDepartmentsTable()->updateAssigned($submittedObj);        }           
    }      
    $view = new ViewModel(array(          
        'assStd'  => $assSub,          
        'flashMessages'     => $this->flashMessenger()->getMessages()
            )
    );

回答1:


i just call $this->getTblInstitutesDepartmentsTable()->getAssignedDetails($urlassId) this to view model

// $assSub=$this->getTblInstitutesDepartmentsTable()->getAssignedDetails($urlassId);

$request = $this->getRequest();
if($request->isPost()){

   $submittedArray = $request->getPost()->toArray();

   $remarks = $submittedArray['remark'];

   $grades  = $submittedArray['grade'];

   $submittedChk =$submittedArray['submitted']; 

   foreach ($submittedChk as $submitted){ 

         $chksubmitted = 1;     

         $remark = $remarks[$submitted]; 

         $grade  = $grades[$submitted];

            $submittedObj =  new TblInstitutesDepartmentModel(array('asid' => $sub,'gd_id' => $grd,'rem' => $rem,'is_sub' => $chksub,'sub_date'=>date('Y-m-d'))); 

            $this->getTblInstitutesDepartmentsTable()->updateAssigned($submittedObj);        }           
}      
$view = new ViewModel(array(          
    //'assStd'  => **$assSub**,
      'assStd'  =>  $this->getTblInstitutesDepartmentsTable()->getAssignedDetails($urlassId),       
    'flashMessages'     => $this->flashMessenger()->getMessages()
        )
);


来源:https://stackoverflow.com/questions/29151729/hy000-2014-cannot-execute-queries-while-other-unbuffered-queries-are-active

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!