<?php
require_once "../config.php"; // $dbh = PDO



try {
    $stmt = $dbh->query("SELECT id, session_year FROM sessions ORDER BY id DESC");
    $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);

    echo json_encode([
        "success" => true,
        "data" => $rows
    ]);
} catch (Exception $e) {
    echo json_encode([
        "success" => false,
        "message" => $e->getMessage()
    ]);
}
