<?php
include 'db.php';
$result = $conn->query("SELECT i.id, i.name, u.name AS unit_name, u.symbol AS unit_symbol FROM items i JOIN uoms u ON i.uom_id = u.id WHERE i.item_role = 'material' ORDER BY i.name ASC");
$data = [];
while ($row = $result->fetch_assoc()) {
    $data[] = $row;
}
echo json_encode($data);
