throwExceptions = true;
try {
// begin transaction
$db->transactionBegin();
foreach ($_POST['recordsIds'] as $record_pk_value) {
// Delete from target table
$filter = array();
$filter[""] = Mysql::SQLValue($record_pk_value);
if (DEMO !== true && !$db->deleteRows('', $filter)) {
$error = $db->error();
$db->transactionRollback();
throw new \Exception($error);
}
} // end foreach
// ALL OK
$db->transactionEnd();
$msg = Utils::alert(count($_POST['recordsIds']) . BULK_DELETE_SUCCESS_MESSAGE, 'alert-success has-icon');
} catch(\Exception $e) {
$msg_content = DB_ERROR;
if (ENVIRONMENT == 'development') {
$msg_content .= '
' . $e->getMessage() . '
' . $db->getLastSql();
}
$msg = Utils::alert($msg_content, 'alert-danger has-icon');
}
} // END if (isset($_POST['recordsIds']))
echo $msg;
} // END if POST
} // END if Secure