语句无法执行(HY000 - 2014 - 当其他未缓冲的查询处于活动状态时无法执行查询。请考虑使用PDOStatement :: fetchAll()。或者,如果您的代码只是针对mysql运行,则可以启用查询通过设置PDO :: MYSQL_ATTR_USE_BUFFERED进行缓冲我在zf2中运行操作时出现此错误,如何解决此问题
{ $ assSub = $这 - > 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()
)
);
答案 0 :(得分:0)
我只需拨打 $ this-> getTblInstitutesDepartmentsTable() - > getAssignedDetails($ urlassId)来查看模型
// $ 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()
)
);