0

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()
            )
    );
Rajeesh
  • 1
  • 3
  • 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 – Álvaro González Mar 19 '15 at 17:57
  • yes Mr.Alvaro you are right, but this issue is solved simply circumstantial basis... called the table function to the view model directly. Most of the freshers will not listen this thing , than k you – Rajeesh Mar 19 '15 at 18:30

1 Answers1

0

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()
        )
);
Rajeesh
  • 1
  • 3