lwb5-in-2025/scripts/game/main/rankings/library/getAll.inc

28 lines
474 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class main_rankings_getAll {
function main_rankings_getAll($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
function run($type, $top = null) {
if (is_null($top)) {
$qs = "";
} else {
$qs = "AND ranking<=$top";
}
$rs = array();
$q = $this->db->query("SELECT id,points,ranking FROM ranking WHERE r_type=$type $qs ORDER BY ranking ASC,id ASC");
while ($r = dbFetchHash($q)) {
array_push($rs, $r);
}
return $rs;
}
}
?>