From 067f5fc1c96ec2777297c3d5aa395c011db36a9c Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Wed, 20 Aug 2025 17:37:54 -0700 Subject: [PATCH] Fix chatroom messages --- database/getChatroomMessages.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/getChatroomMessages.php b/database/getChatroomMessages.php index 7306a10..ae79c52 100644 --- a/database/getChatroomMessages.php +++ b/database/getChatroomMessages.php @@ -9,11 +9,11 @@ $stmt = $conn->prepare(" FROM chats c JOIN users u ON c.userId = u.id WHERE u.banned = 0 AND c.deleted = 0 - ORDER BY c.id ASC LIMIT 50 + ORDER BY c.id DESC LIMIT 50 "); $stmt->execute(); $result = $stmt->get_result(); -echo encrypt(json_encode(array_map(fn($row) => ['username' => $row['username'], 'userid' => $row['user_id'], 'content' => $row['content'], 'id' => $row['chat_id'], 'icon' => $row['icon'], 'overlay' => $row['overlay'], 'birdColor' => json_decode($row['birdColor']), 'overlayColor' => json_decode($row['overlayColor'])], $result->fetch_all(MYSQLI_ASSOC)))); +echo encrypt(json_encode(array_reverse(array_map(fn($row) => ['username' => $row['username'], 'userid' => $row['user_id'], 'content' => $row['content'], 'id' => $row['chat_id'], 'icon' => $row['icon'], 'overlay' => $row['overlay'], 'birdColor' => json_decode($row['birdColor']), 'overlayColor' => json_decode($row['overlayColor'])], $result->fetch_all(MYSQLI_ASSOC))))); $conn->close(); \ No newline at end of file