<?php
include 'includes/config.php';

$query = 'SELECT id, name FROM categories WHERE parent_id IS NULL';
$stmt = $conn->query($query);

$categories = $stmt->fetchAll(PDO::FETCH_ASSOC);

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