0) {
$db = new Mysql();
$db->throwExceptions = true;
try {
// begin transaction
$db->transactionBegin();
// Delete from target table
$filter = array();
$filter[""] = Mysql::SQLValue($_POST['']);
if (DEMO === true || $db->deleteRows('', $filter)) {
// ALL OK
$db->transactionEnd();
$_SESSION['msg'] = Utils::alert(UPDATE_SUCCESS_MESSAGE, 'alert-success has-icon');
} else {
$error = $db->error();
$db->transactionRollback();
throw new \Exception($error);
}
} catch(\Exception $e) {
$msg_content = DB_ERROR;
if (ENVIRONMENT == 'development') {
$msg_content .= '
' . $e->getMessage() . '
' . $db->getLastSql();
}
$_SESSION['msg'] = Utils::alert($msg_content, 'alert-danger has-icon');
}
}
// reset form values
Form::clear('form-delete-');
// redirect to list page
if (isset($_SESSION['active_list_url'])) {
header('Location:' . $_SESSION['active_list_url']);
} else {
header('Location:' . ADMIN_URL . '');
}
// if we don't exit here, $_SESSION['msg'] will be unset
exit();
} // END if POST
$ = $pk;
// select name to display for confirmation
$qry = 'SELECT FROM WHERE = ' . Mysql::sqlValue($) . ' LIMIT 1';
$db = new Mysql();
$db->query($qry);
$count = $db->rowCount();
if (!empty($count)) {
$row = $db->row();
$display_value = $row->;
} else {
// this should never happen
// echo $db->getLastSql();
exit('QRY ERROR');
}
$form = new Form('form-delete-', 'vertical', 'novalidate', 'bs4');
$form->setAction(ROOT_RELATIVE_URL . 'admin//delete/' . $);
$form->startFieldset();
$form->addInput('hidden', '', $);
$form->addHtml('