prepare($query);
$stmt->bind_param("ii", $Program_ID, $Group_ID);
$stmt->execute();
$result = $stmt->get_result();
// Get group info
$queryw = "SELECT Group_ID, Group_Name FROM Manager_Group_Name WHERE Group_ID = ? AND Program_ID = ?";
$stmtw = $mysqli->prepare($queryw);
$stmtw->bind_param("ii", $Group_ID, $Program_ID);
$stmtw->execute();
$resultw = $stmtw->get_result();
$rowsw = $resultw->fetch_assoc();
$stmtw->close();
while ($row = $result->fetch_assoc()) {
$queryq = "
SELECT Date, Slot, Time, Course_ID, Course_Name, Is_Exam
FROM Final_Group_Schedule
WHERE Program_ID = ? AND Group_ID = ? AND Course_ID = ?
ORDER BY Date
";
$stmtq = $mysqli->prepare($queryq);
$stmtq->bind_param("iii", $Program_ID, $Group_ID, $row['Course_ID']);
$stmtq->execute();
$resultsq = $stmtq->get_result();
while ($schedule = $resultsq->fetch_assoc()) {
$day = date('l', strtotime($schedule['Date'])); // e.g., Monday
$dateFormatted = "($day) " . $schedule['Date'];
$isExam = $schedule['Is_Exam'] ? true : false;
$rowStyle = $isExam ? 'style="background-color:#f8d7da; color:#721c24;"' : '';
echo "
| " . htmlspecialchars($rowsw['Group_Name']) . " |
" . htmlspecialchars($dateFormatted) . " |
" . htmlspecialchars($schedule['Slot']) . " |
" . htmlspecialchars($schedule['Course_Name']) . " |
" . htmlspecialchars($schedule['Time']) . " |
" . ($isExam ? '✅ Yes' : '-') . " |