Beispiel #1
0
 public function getRowsAtRank($rank, $total = 1)
 {
     if (!isset($this->_additional_where)) {
         return parent::getRowsAtRank($rank, $total);
     }
     $rank = intval(self::$mysqli_connection->real_escape_string($rank));
     $total = intval(self::$mysqli_connection->real_escape_string($total));
     $query = "SELECT * " . "FROM `{$this->table_name}` " . "WHERE " . $this->_additional_where . " " . "ORDER BY {$this->row_score} DESC " . "LIMIT {$rank}, {$total}";
     $res = self::$mysqli_connection->query($query);
     if (!$res) {
         throw new Exception("Query rows failed: (" . self::$mysqli_connection->errno . ") " . self::$mysqli_connection->error);
     }
     if ($res->num_rows === 0) {
         return array();
     }
     $rows = array();
     while ($row = $res->fetch_assoc()) {
         $rows[] = $row;
     }
     return $rows;
 }