if ((isSqlsValid()) && (isSqlsValid())) {
if (strpos($GLOBALS['sqls'][0], 'INSERT') > -1) {
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE level='%s' LIMIT 1",
- array(bigintval(postRequestElement('level'))), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_refdepths` WHERE `level`='%s' LIMIT 1",
+ array(bigintval(postRequestElement('level'))), __FILE__, __LINE__);
SQL_FREERESULT($result);
} // END - if
if (isPostRequestElementSet('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 = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s AND `price_level`='%s' LIMIT 1",
array(bigintval(getRequestElement('rallye')), bigintval(postRequestElement('level'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 0) {
$id = bigintval($id);
// Update entry
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_prices` SET rallye_id=%s, price_level='%s', points='%s', info='%s' WHERE `id`=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_rallye_prices` SET rallye_id=%s, price_`level`='%s', points='%s', info='%s' WHERE `id`=%s LIMIT 1",
array(
postRequestElement('rallye_id', $id),
bigintval($level),
$REFS = 0;
// Load referal points
- $result_points = SQL_QUERY_ESC("SELECT points, locked_points FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1", array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__);
+ $result_points = SQL_QUERY_ESC("SELECT `points`, `locked_points` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1", array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__);
if (SQL_NUMROWS($result_points) == 1) {
list($points, $locked) = SQL_FETCHROW($result_points);
// Also count locked points
SQL_FREERESULT($result_points);
// Load referal counts
- $result_refs = SQL_QUERY_ESC("SELECT counter FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `userid`=%s AND level='%s' LIMIT 1",
+ $result_refs = SQL_QUERY_ESC("SELECT `counter` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `userid`=%s AND `level`='%s' LIMIT 1",
array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__);
if (SQL_NUMROWS($result_refs) == 1) {
list($REFS) = SQL_FETCHROW($result_refs);
// Transfer data to array for template
$row = array(
- 'level' => $content['level'],
+ 'level' => $content['level'],
'percents' => translateComma($content['percents']),
- 'points' => translateComma($points),
- 'refs' => translateComma($REFS),
+ 'points' => translateComma($points),
+ 'refs' => translateComma($REFS),
);
// Output row
// Remember several values in constants
$content['used'] = translateComma($usedPoints);
-$content['tpts'] = translateComma($totalPoints - $usedPoints);
+$content['sum'] = translateComma($totalPoints - $usedPoints);
$content['tref'] = $TREF;
$content['tlock'] = translateComma($TLOCK);