/home/techb158/workloadmatch.com/Manager
Edit: /home/techb158/workloadmatch.com/Manager/fetch_reserve_courses.php (7567B)
prepare($query);
$stmt->bind_param("i", $programID);
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
$courseID = $row["Course_ID"];
// Check if the combination of Program_ID, Course_ID, and Group_ID exists in course_group_schedule
//$checkStmt = $mysqli->prepare("SELECT COUNT(*) FROM course_group_schedule WHERE Program_ID = ? AND Course_ID = ? AND Group_ID = ?");
$checkStmt = $mysqli->prepare("SELECT COUNT(*) FROM course_group_schedule WHERE Program_ID = ? AND Course_ID = ? AND Group_ID = ? AND Assigned=0");
if (!$checkStmt) {
die("Error preparing assignment check query: " . $mysqli->error);
}
$checkStmt->bind_param('iii', $programID, $courseID, $groupID);
$checkStmt->execute();
$checkStmt->bind_result($count);
$checkStmt->fetch();
$checkStmt->close();
// If combination exists in course_group_schedule
if ($count > 0) {
// Fetch additional schedule details for this combination
$fetchStmt = $mysqli->prepare("SELECT Reserve_Course, Time_Slot, Start_Date, End_Date, Start_Time, End_Time FROM course_group_schedule WHERE Program_ID = ? AND Course_ID = ? AND Group_ID = ? AND Assigned=0");
$fetchStmt->bind_param('iii', $programID, $courseID, $groupID);
$fetchStmt->execute();
$fetchStmt->bind_result($Reserve_Course, $Time_Slot, $Start_Date, $End_Date, $Start_Time, $End_Time);
$fetchStmt->fetch();
$fetchStmt->close();
// Assuming $Reserve_Course is a variable that holds the value (either 0 or 1)
$checkedReserve = (isset($Reserve_Course) && $Reserve_Course == 1) ? 'checked' : ''; // Set checked if $Reserve_Course is 1
echo "
|
|
{$row["Course_Name"]} |
|
|
|
|
|
";
} else {
// // If the combination doesn't exist in course_group_schedule
// echo "
// |
// |
// {$row["Course_Name"]} |
//
//
// |
// |
// |
// |
// |
//
";
}
}
$stmt->close();
$mysqli->close();
}
//if (isset($_POST["Program_ID"]) && isset($_POST["Group_ID"])) {
// $programID = $_POST["Program_ID"];
// $groupID = $_POST["Group_ID"];
//
// $query = "SELECT Course_ID, Course_Name FROM Courses WHERE Program_ID = ?";
// $stmt = $mysqli->prepare($query);
// $stmt->bind_param("i", $programID);
// $stmt->execute();
// $result = $stmt->get_result();
//
// while ($row = $result->fetch_assoc()) {
// echo "
// |
// |
//
// {$row["Course_Name"]} |
//
//
// |
// |
// |
// |
// |
//
";
// }
// $stmt->close();
// $mysqli->close();
//}
?>