if (isFormSent('add')) {
if ((isPostRequestElementSet('level')) && ((isPostRequestElementSet('points')) || (isPostRequestElementSet('info')))) {
// Submitted data is valid, but maybe we already have this price level?
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s AND `price_level`='%s' LIMIT 1",
+ $result = sqlQueryEscaped("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s AND `price_level`='%s' LIMIT 1",
array(bigintval(getRequestElement('rallye_id')), bigintval(postRequestElement('level'))), __FILE__, __LINE__);
- if (SQL_HASZERONUMS($result)) {
+ if (ifSqlHasZeroNums($result)) {
// Ok, new price level entered!
- SQL_QUERY_ESC("INSERT INTO
+ sqlQueryEscaped("INSERT INTO
`{?_MYSQL_PREFIX?}_rallye_prices`
(`rallye_id`, `price_level`, `points`, `info`)
VALUES
displayMessage('{--ADMIN_RALLYE_PRICE_LEVEL_SAVED--}');
} else {
// Free memory
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
// Price level found
displayMessage('{--ADMIN_RALLYE_PRICE_ALREADY_FOUND--}');
if (ifPostContainsSelections()) {
// Delete selected entries
foreach (postRequestElement('sel') as $id => $sel) {
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `id`=%s LIMIT 1",
+ sqlQueryEscaped("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
} // END - foreach
$id = bigintval($id);
// Update entry
- SQL_QUERY_ESC("UPDATE
+ sqlQueryEscaped("UPDATE
`{?_MYSQL_PREFIX?}_rallye_prices`
SET
`rallye_id`=%s,
$OUT = '';
foreach (postRequestElement('sel') as $id => $sel) {
// Load data to selected rallye
- $result = SQL_QUERY_ESC("SELECT
+ $result = sqlQueryEscaped("SELECT
`id`,
`rallye_id`,
`price_level`,
array(bigintval($id)), __FILE__, __LINE__);
// Fetch data
- $content = SQL_FETCHARRAY($result);
+ $content = sqlFetchArray($result);
// Free result
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
// Add more content
$content['rallye_content'] = generateOptions('rallye_data', 'id', 'title', $content['rallye_id']);
$OUT = '';
foreach (postRequestElement('sel') as $id => $sel) {
// Load data to selected rallye
- $result = SQL_QUERY_ESC("SELECT
+ $result = sqlQueryEscaped("SELECT
`id`,
`rallye_id`,
`price_level`,
array(bigintval($id)), __FILE__, __LINE__);
// Fetch data
- $content = SQL_FETCHARRAY($result);
+ $content = sqlFetchArray($result);
// Free result
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
// Load row template and switch color
$OUT .= loadTemplate('admin_delete_rallye_prices_row', TRUE, $content);
}
} else {
// A rallye was selected, so check if there are already prices assigned...
- $result = SQL_QUERY_ESC("SELECT `id`, `price_level`, `points`, `info` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s ORDER BY `price_level` ASC",
+ $result = sqlQueryEscaped("SELECT `id`, `price_level`, `points`, `info` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s ORDER BY `price_level` ASC",
array(bigintval(getRequestElement('rallye_id'))), __FILE__, __LINE__);
- if (!SQL_HASZERONUMS($result)) {
+ if (!ifSqlHasZeroNums($result)) {
// Load all prices for the selected rallye
$OUT = '';
- while ($content = SQL_FETCHARRAY($result)) {
+ while ($content = sqlFetchArray($result)) {
// Load row template and switch color
$OUT .= loadTemplate('admin_list_rallye_prices_simple_row', TRUE, $content);
} // END - while
// Free memory
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
// @TODO Rewrite these two constants
$content['rows'] = $OUT;
} // END - if
} else {
// No rallye selected so display all available without prices
- $result = SQL_QUERY("SELECT
+ $result = sqlQuery("SELECT
`d`.`id` AS `rallye_id`,
`d`.`admin_id`,
`d`.`start_time`,
`d`.`admin_id`=`a`.`id`
ORDER BY
`d`.`start_time` DESC", __FILE__, __LINE__);
- if (!SQL_HASZERONUMS($result)) {
+ if (!ifSqlHasZeroNums($result)) {
// List found rallyes
$OUT = '';
- while ($content = SQL_FETCHARRAY($result)) {
+ while ($content = sqlFetchArray($result)) {
// Prepare data for the row template
$content['start_time'] = generateDateTime($content['start_time'], '3');
$content['end_time'] = generateDateTime($content['end_time'] , '3');
} // END - while
// Free memory
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
// Load main template
loadTemplate('admin_list_rallye_prices', FALSE, $OUT);