<?php
require 'db.php';

$stmt = $pdo->query("SELECT * FROM messegedetails ORDER BY id DESC");
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);

echo json_encode(['status' => true, 'messages' => $messages]);
?>
