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

$res = mysqli_query($con, "SELECT id, mesa_id as mesa, hora, detalle FROM comandas_cocina ORDER BY id DESC LIMIT 1");
if ($row = mysqli_fetch_assoc($res)) {
    echo json_encode($row);
} else {
    echo json_encode(["id" => 0]);
}
?>