Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class RSS {
- var $username = "root";
- var $password = "password";
- var $server = "localhost";
- var $port = "3306";
- var $databasename = "techno_noise";
- var $tablename = "files";
- var $connection;
- public function __construct() {
- $this->connection = mysqli_connect(
- $this->server,
- $this->username,
- $this->password,
- $this->databasename,
- $this->port
- );
- $this->throwExceptionOnError($this->connection);
- }
- public function getFeatured() {
- $stmt = mysqli_prepare($this->connection, "SELECT * FROM files WHERE featured = true ");
- $this->throwExceptionOnError();
- mysqli_stmt_execute($stmt);
- $this->throwExceptionOnError();
- $rowsFeatured = array();
- mysqli_stmt_bind_result($stmt, $row->filename, $row->dj, $row->name, $row->hash);
- while (mysqli_stmt_fetch($stmt)) {
- $rowsFeatured[] = $row;
- $row = new stdClass();
- mysqli_stmt_bind_result($stmt, $row->filename, $row->dj, $row->name, $row->hash);
- }
- mysqli_stmt_free_result($stmt);
- mysqli_close($this->connection);
- return $rowsFeatured;
- }
- public function getNewest() {
- $stmt = mysqli_prepare($this->connection, "SELECT MAX(date) FROM files LIMIT 5");
- $this->throwExceptionOnError();
- mysqli_stmt_execute($stmt);
- $this->throwExceptionOnError();
- $rowsNewest = array();
- mysqli_stmt_bind_result($stmt, $row->filename, $row->dj, $row->name, $row->hash);
- while (mysqli_stmt_fetch($stmt)) {
- $rowsNewest[] = $row;
- $row = new stdClass();
- mysqli_stmt_bind_result($stmt, $row->filename, $row->dj, $row->name, $row->hash);
- }
- mysqli_stmt_free_result($stmt);
- mysqli_close($this->connection);
- return $rowsNewest;
- }
- public function getBest() {
- $stmt = mysqli_prepare($this->connection, "SELECT MAX(ranking) FROM files LIMIT 5");
- $this->throwExceptionOnError();
- mysqli_stmt_execute($stmt);
- $this->throwExceptionOnError();
- $rowsBest = array();
- mysqli_stmt_bind_result($stmt, $row->filename, $row->dj, $row->name, $row->hash);
- while (mysqli_stmt_fetch($stmt)) {
- $rowsBest[] = $row;
- $row = new stdClass();
- mysqli_stmt_bind_result($stmt, $row->filename, $row->dj, $row->name, $row->hash);
- }
- mysqli_stmt_free_result($stmt);
- mysqli_close($this->connection);
- return $rowsBest;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement