Last active
August 29, 2015 14:01
-
-
Save auxiliary-character/d860760cdbf29b6c4bbe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getTopPlayers($mysqli, $dbPrefix, $stat, $page) | |
{ | |
$query; | |
switch ($stat) { | |
//irrelevant stuff removed | |
default: | |
$query = "SELECT player_id,SUM(?) AS value FROM {?}player " | |
. (usesSnapshots($mysqli, $dbPrefix) ? " WHERE snapshot_name='main_snapshot'" : "") | |
. " GROUP BY player_id ORDER BY SUM(?) DESC LIMIT 15 OFFSET ?"; | |
} | |
$result = $mysqli->query($query,getDatabaseColumnNameFromPlayerStat($stat),$dbPrefix,getDatabaseColumnNameFromPlayerStat($stat),(($page - 1) * 15)); | |
return $result; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment