Queries improved, output-bug fixed in points overview
authorRoland Häder <roland@mxchange.org>
Thu, 29 Oct 2009 18:41:24 +0000 (18:41 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 29 Oct 2009 18:41:24 +0000 (18:41 +0000)
inc/modules/admin/what-config_points.php
inc/modules/admin/what-config_rallye_prices.php
inc/modules/member/what-points.php
templates/de/html/member/member_points.tpl

index b8a62ba..724779b 100644 (file)
@@ -135,8 +135,8 @@ WHERE `mails_confirmed` < %s", $REF, $REF));
 
        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
 
index ddb605d..bce9f0c 100644 (file)
@@ -49,7 +49,7 @@ if (isGetRequestElementSet(('rallye'))) {
        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) {
@@ -93,7 +93,7 @@ VALUES ('%s','%s','%s','%s')",
                        $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),
index 947a9ed..fea4cd2 100644 (file)
@@ -71,7 +71,7 @@ while ($data = SQL_FETCHARRAY($result_depths)) {
        $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
@@ -84,7 +84,7 @@ while ($data = SQL_FETCHARRAY($result_depths)) {
        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);
@@ -98,10 +98,10 @@ while ($data = SQL_FETCHARRAY($result_depths)) {
 
        // 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
@@ -145,7 +145,7 @@ if ($TLOCK == 0) $TLOCK = '0.00000';
 
 // 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);
 
index 8664012..4580dae 100644 (file)
@@ -29,7 +29,7 @@
                <td class="member_data">&nbsp;&nbsp;<strong>{--POINTS_SUM--}</strong></td>
                <td width="2" class="seperator">&nbsp;</td>
                <td class="member_data">
-                       &nbsp;&nbsp;<strong>$content[used] {?POINTS?}</strong>
+                       &nbsp;&nbsp;<strong>$content[sum] {?POINTS?}</strong>
                </td>
                <td width="2" class="seperator">&nbsp;</td>
                <td class="member_data">&nbsp;&nbsp;<strong>$content[tref]</strong></td>