File "get_exam_dates.php"

Full path: /home2/santhos2/public_html/bharath-coe.firstmatrix.in.net/api/invigilation/get_exam_dates.php
File size: 1.08 KiB (1104 bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Back

<?php
require_once '../../config/config.php';

header('Content-Type: application/json');

try {
    $academicYear = trim($_GET['academic_year'] ?? '');
    
    if (!$academicYear) {
        throw new Exception('Academic Year is required');
    }
    
    // Get distinct exam dates for invigilation duties
    $stmt = $pdo->prepare("
        SELECT DISTINCT et.exam_date
        FROM invigilation_duty id
        JOIN exam_timetable et ON id.timetable_id = et.timetable_id
        JOIN exam_subjects es ON et.exam_subject_id = es.exam_subject_id
        JOIN exams e ON es.exam_id = e.exam_id
        WHERE e.academic_year = ?
        ORDER BY et.exam_date ASC
    ");
    
    $stmt->execute([$academicYear]);
    $dates = $stmt->fetchAll(PDO::FETCH_ASSOC);
    
    echo json_encode([
        'success' => true,
        'data' => $dates
    ]);
    
} catch (Exception $e) {
    http_response_code(500);
    echo json_encode([
        'success' => false,
        'message' => $e->getMessage()
    ]);
}
?>




























PHP File Manager