Queries improved, output-bug fixed in points overview
[mailer.git] / inc / modules / member / what-points.php
index 947a9edefc0d044ad0f7c9d335434d4c92bb23f2..fea4cd288516d13bc21388eecf0549750cb2f743 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);