<?php
include('includes/db.php');

if (isset($_POST['exam_id']) && isset($_POST['class_id'])) {
    $examId = $conn->real_escape_string($_POST['exam_id']);
    $classId = $conn->real_escape_string($_POST['class_id']);

    $query = "
        SELECT result_date 
        FROM result_publication 
        WHERE exam_id = '$examId' AND class_id = '$classId' 
        LIMIT 1
    ";
    $result = $conn->query($query);

    if ($result && $row = $result->fetch_assoc()) {
        echo $row['result_date'];
    } else {
        echo ''; // No result found
    }
}
?>
