protected function post_newTender_handler() { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $newID = 1; $idQ = $dbc->prepare_statement("SELECT MAX(TenderID) FROM tenders"); $idR = $dbc->exec_statement($idQ); if ($dbc->num_rows($idR) > 0) { $idW = $dbc->fetch_row($idR); if (!empty($idW[0])) { $newID = $idW[0] + 1; } } $model = new TendersModel($dbc); $model->TenderID($newID); $model->TenderName('NEW TENDER'); $model->TenderType('CA'); $model->MinAmount(0); $model->MaxAmount(500); $model->MaxRefund(0); $model->save(); echo $this->getTenderTable(); return false; }