<?php
header("Content-Type: application/json");
require("../includes/config.php");


try {
    $stmt = $pdo->query(
        "SELECT id, class_name 
         FROM classes 
         WHERE status = 1 
         ORDER BY class_name ASC"
    );

    echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
} catch (Exception $e) {
    echo json_encode([]);
}