<?php
require_once __DIR__ . '/../includes/auth.php';
header('Content-Type: application/json');

$pid = (int)($_GET['project_id'] ?? 0);
$out = [];
$res = $conn->query("SELECT id, name FROM categories WHERE project_id=$pid ORDER BY name");
while ($r = $res->fetch_assoc()) $out[] = $r;
echo json_encode($out);
