<?php
require_once __DIR__ . '/../config/user_functions.php';

require_once __DIR__ . '/../config/db_remote.php';

$res = $mysqli->query("SELECT id, serial, variety, grower, lot, harvested_at, production_line, read_at FROM boxes_produced ORDER BY id DESC LIMIT 500");
$data = $res ? $res->fetch_all(MYSQLI_ASSOC) : [];

echo json_encode(["data" => $data]);
