<?php
require 'db.php';

$q = $conn->query("SELECT id, name FROM categories WHERE status='active' ORDER BY sort_order");

$data = [];
while ($row = $q->fetch_assoc()) {
    $data[] = $row;
}

header('Content-Type: application/json');
echo json_encode($data);
