]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_user_amounts.php
Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / modules / admin / what-list_user_amounts.php
index cb6958a305fea1432c5f117c0c8998d00edbd06a..84bf3a6673ed83bd8371a17143350bbc8e0791b9 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -54,7 +54,7 @@ foreach (runFilterChain('locked_points_columns_array', array('points')) as $colu
 $sql = substr($sql, 0, -1);
 
 // Run the query to obtain all user's amounts (regardless of their status)
-$result = SQL_QUERY('SELECT
+$result = sqlQuery('SELECT
        `p`.`userid`,
        SUM(
                ' . $sql . ' -
@@ -72,13 +72,13 @@ ORDER BY
        `p`.`userid` ASC', __FILE__, __LINE__);
 
 // Are there entries? (sorry, the XML functions cannot "produce" the above SQL statement)
-if (!SQL_HASZERONUMS($result)) {
+if (!ifSqlHasZeroNumRows($result)) {
        // Init amounts and points
        $totalPoints = '0';
        $amounts = array();
 
        // Then load all
-       while ($row = SQL_FETCHARRAY($result)) {
+       while ($row = sqlFetchArray($result)) {
                // Add it
                $amounts[$row['userid']] = $row;
                $totalPoints            += $row['points'];
@@ -93,7 +93,7 @@ if (!SQL_HASZERONUMS($result)) {
        // ... and display all
        foreach ($amounts as $userid => $row) {
                // Calculate and add percentage to data array
-               $row['percents'] = $row['points'] / $totalPoints * 100;
+               $row['percents'] = calculatePercentageRate($row['points'], $totalPoints);
 
                // Load row template
                $out['rows'] .= loadTemplate('admin_list_user_amounts_row', TRUE, $row);
@@ -107,7 +107,7 @@ if (!SQL_HASZERONUMS($result)) {
 }
 
 // Free result
-SQL_FREERESULT($result);
+sqlFreeResult($result);
 
 // [EOF]
 ?>