function updateAttd(&$response, array $objs) { /* insert into Attendance(lec_id,stud_id,presence) VALUES(1,3,0),(1,6,1),(1,2,1) on duplicate key update presence = VALUES(presence) */ try { $dbh = new MyDbCon(); $dbh->multiUpdate($objs, array("presence")); $dbh->execute(); return true; } catch (\Exception $e) { $message = $e->getPrevious() ? $e->getPrevious()->getMessage() : $e->getMessage(); $code = $e->getPrevious() ? $e->getPrevious()->getCode() : $e->getCode(); $err = "Error Code: " . $code . " <br/>Detailed Info: " . $message; $response = array('code' => HTTP_Status::FORBIDDEN, 'message' => $err); return false; } }