<?php
include 'config.php';
header('Content-Type: application/json');

$res = $conn->query("
SELECT *
FROM gift_requests
ORDER BY id DESC
");

$data = [];

while($row = $res->fetch_assoc()){
    $data[] = $row;
}

echo json_encode([
    "status" => "success",
    "total" => count($data),
    "data" => $data
]);
?>