
<?php
require_once '../conexion.php';
$mesa_id = intval($_GET['mesa_id'] ?? 0);
$comentarios = [];
if($mesa_id){
  $res = mysqli_query($con,"SELECT texto, DATE_FORMAT(fecha,'%H:%i') as hora FROM comentarios_mesa WHERE mesa_id=$mesa_id ORDER BY id ASC");
  $comentarios = mysqli_fetch_all($res,MYSQLI_ASSOC);
}
header('Content-Type: application/json');
echo json_encode(['comentarios'=>$comentarios]);
