X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_user_amounts.php;h=84bf3a6673ed83bd8371a17143350bbc8e0791b9;hp=de0fdfd4464d857ae5017f07fdd864eb2a4271f2;hb=49acdb7a7adbcf25a8e8683b5581bfcec72b23bd;hpb=16e8327d8b9ac2f02cf49c6179e7148fc32b1066 diff --git a/inc/modules/admin/what-list_user_amounts.php b/inc/modules/admin/what-list_user_amounts.php index de0fdfd446..84bf3a6673 100644 --- a/inc/modules/admin/what-list_user_amounts.php +++ b/inc/modules/admin/what-list_user_amounts.php @@ -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 * @@ -47,38 +47,38 @@ addYouAreHereLink('admin', __FILE__); $sql = ''; foreach (runFilterChain('locked_points_columns_array', array('points')) as $column) { // Add it with/-out locked - $sql .= 'p.`' . $column . '` + p.`locked_' . $column . '` +'; + $sql .= '`p`.`' . $column . '` + `p`.`locked_' . $column . '` +'; } // END - foreach // Remove last plus $sql = substr($sql, 0, -1); // Run the query to obtain all user's amounts (regardless of their status) -$result = SQL_QUERY('SELECT - d.`userid`, +$result = sqlQuery('SELECT + `p`.`userid`, SUM( ' . $sql . ' - - d.`used_points` + `d`.`used_points` ) AS `points` FROM `{?_MYSQL_PREFIX?}_user_points` AS `p` INNER JOIN `{?_MYSQL_PREFIX?}_user_data` AS `d` ON - d.`userid`=p.`userid` + `d`.`userid`=`p`.`userid` GROUP BY - d.`userid` + `p`.`userid` ORDER BY - d.`userid` ASC', __FILE__, __LINE__); + `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] ?>