From bfcf14a74c37b6fd6b9655e5151708b94ad5763c Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Fri, 21 Jun 2013 20:29:21 +0200 Subject: [PATCH] Sort news by time, newest first Fixes #231 --- public/include/classes/news.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/include/classes/news.class.php b/public/include/classes/news.class.php index 61762a27..3f3f8631 100644 --- a/public/include/classes/news.class.php +++ b/public/include/classes/news.class.php @@ -23,7 +23,7 @@ class News extends Base { **/ public function getAllActive() { $this->debug->append("STA " . __METHOD__, 4); - $stmt = $this->mysqli->prepare("SELECT n.*, a.username AS author FROM $this->table AS n LEFT JOIN " . $this->user->getTableName() . " AS a ON a.id = n.account_id WHERE active = 1"); + $stmt = $this->mysqli->prepare("SELECT n.*, a.username AS author FROM $this->table AS n LEFT JOIN " . $this->user->getTableName() . " AS a ON a.id = n.account_id WHERE active = 1 ORDER BY time DESC"); if ($stmt && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); // Catchall @@ -35,7 +35,7 @@ class News extends Base { **/ public function getAll() { $this->debug->append("STA " . __METHOD__, 4); - $stmt = $this->mysqli->prepare("SELECT n.*, a.username AS author FROM $this->table AS n LEFT JOIN " . $this->user->getTableName() . " AS a ON a.id = n.account_id"); + $stmt = $this->mysqli->prepare("SELECT n.*, a.username AS author FROM $this->table AS n LEFT JOIN " . $this->user->getTableName() . " AS a ON a.id = n.account_id ORDER BY time DESC"); if ($stmt && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); // Catchall