$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 . ' -
`p`.`userid` ASC', __FILE__, __LINE__);
// Are there entries? (sorry, the XML functions cannot "produce" the above SQL statement)
-if (!SQL_HASZERONUMS($result)) {
+if (!ifSqlHasZeroNums($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'];
// ... 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);
}
// Free result
-SQL_FREERESULT($result);
+sqlFreeResult($result);
// [EOF]
?>