diff --git a/database/getChatroomMessages.php b/database/getChatroomMessages.php index bed49ce..c1ab513 100644 --- a/database/getChatroomMessages.php +++ b/database/getChatroomMessages.php @@ -5,7 +5,7 @@ checkClientDatabaseVersion(); $conn = newConnection(); $stmt = $conn->prepare(" - SELECT c.id, c.content, u.username, u.icon, u.overlay, u.id, u.birdColor, u.overlayColor + SELECT c.id AS chat_id, c.content, u.username, u.icon, u.overlay, u.id AS user_id, u.birdColor, u.overlayColor FROM chats c JOIN users u ON c.userId = u.id WHERE u.banned = 0 AND c.deleted = 0 @@ -14,6 +14,6 @@ $stmt = $conn->prepare(" $stmt->execute(); $result = $stmt->get_result(); -echo encrypt(json_encode(array_map(fn($row) => ['username' => $row['username'], 'userid' => $row['id'], 'content' => $row['content'], 'id' => $row['id'], 'icon' => $row['icon'], 'overlay' => $row['overlay'], 'birdColor' => json_decode($row['birdColor']), 'overlayColor' => json_decode($row['overlayColor'])], $result->fetch_all(MYSQLI_ASSOC)), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +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)), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); $conn->close(); \ No newline at end of file