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

$sql = "SELECT * FROM withdrawals ORDER BY id DESC";
$result = $conn->query($sql);

$withdrawals = [];

if ($result->num_rows > 0) {
  while ($row = $result->fetch_assoc()) {
    $withdrawals[] = $row;
  }
}

echo json_encode($withdrawals);
$conn->close();
?>
