<?php
// ajax/get_classes.php
require '../config.php';
header('Content-Type: application/json');
try {
  $stmt = $dbh->query("SELECT id, name FROM classes ORDER BY name");
  $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
  echo json_encode($rows);
} catch(Exception $e){
  echo json_encode([]);
}
