From dbe2ba98497898c45b840e651a43a39969e1bab0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 13 Sep 2008 16:07:07 +0000 Subject: [PATCH] More places are now using GET_TOTAL_DATA() instead of query --- inc/databases.php | 2 +- inc/modules/member/what-order.php | 7 +------ inc/modules/member/what-payout.php | 6 ++---- inc/mysql-manager.php | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index 76acbfc656..bbd258b26f 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "317"); +define('CURR_SVN_REVISION', "318"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index ccbc0821a5..9bcdff8f57 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -112,12 +112,7 @@ if (SQL_NUMROWS($result_p) > 0) SQL_FREERESULT($result_p); // And subtract his used points... - $result_p = SQL_QUERY_ESC("SELECT used_points FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", - array($GLOBALS['userid']), __FILE__, __LINE__); - - list($p) = SQL_FETCHROW($result_p); - SQL_FREERESULT($result_p); - $TOTAL -= $p; + $TOTAL -= GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points"); // Add (maybe) missing three zeros if (!ereg(".", $TOTAL)) $TOTAL .= ".00000"; diff --git a/inc/modules/member/what-payout.php b/inc/modules/member/what-payout.php index 1983bb7171..7c45d6a89e 100644 --- a/inc/modules/member/what-payout.php +++ b/inc/modules/member/what-payout.php @@ -66,10 +66,8 @@ while (list($lvl, $per) = SQL_FETCHROW($result_depths)) // Free memory SQL_FREERESULT($result_depths); -$result = SQL_QUERY_ESC("SELECT used_points FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", - array($GLOBALS['userid']), __FILE__, __LINE__); -list($USED) = SQL_FETCHROW($result); -SQL_FREERESULT($result); +// Get used points +$USED = GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points"); // Translate point into comma $TPTS = TRANSLATE_COMMA($TPTS - $USED); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 5d52c25fae..19750af9c4 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1637,7 +1637,7 @@ function MODULE_HAS_MENU($mod, $forceDb = false) // Subtract points from database and mediadata cache function SUB_POINTS ($uid, $points) { // Add points to used points - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET used_points=used_points+%s WHERE userid=%s LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `used_points`=`used_points`+%s WHERE userid=%s LIMIT 1", array($points, bigintval($uid)), __FILE__, __LINE__); // Update mediadata as well -- 2.39.5