<?php
include 'db.php';

$result = $conn->query("
  SELECT ho.*, dt.table_name 
  FROM hold_orders ho
  LEFT JOIN dinein_tables dt ON ho.table_id = dt.id
  ORDER BY ho.created_at DESC
");

$orders = [];

while ($row = $result->fetch_assoc()) {
    $orders[] = $row;
}

echo json_encode($orders);
