Example #1
0
function getEnInfo($id, $conn)
{
    //  SQL statement to extract the Enrollment information of the student
    //$sql_en = "select * from course,enrollment natural join class WHERE enrollment.st_id = '".$id."'";
    $sql_en = "select * from course where course_id in (select course_id from class where class_id in (select class_id from enrollment where st_id = '" . $id . "'))";
    $message = '';
    // Checks fot the connection
    if ($conn->connect_error) {
        $message = $conn->connect_error;
        die('Connection error:' . $message);
    } else {
        // Extracts all the relevant enrollment information into $result_en
        $result_en = $conn->query($sql_en);
        // If an error occurs while extracting information
        if ($conn->error) {
            die('Error occurred:' . $conn->error);
        }
    }
    showEnInfo($message, $result_en);
}
Example #2
0
function getEnInfo($conn)
{
    //  SQL statement to extract the Enrollment information of the student
    //$sql_en = "select * from course,enrollment natural join class WHERE enrollment.st_id = '".$id."'";
    $sql_dep = "select dept_id, dept_name from department";
    $message = '';
    // Checks fot the connection
    if ($conn->connect_error) {
        $message = $conn->connect_error;
        die('Connection error:' . $message);
    } else {
        // Extracts all the department ids into $result_en
        $result_dep = $conn->query($sql_dep);
        // If an error occurs while extracting information
        if ($conn->error) {
            die('Error occurred:' . $conn->error);
        }
    }
    showEnInfo($message, $result_dep, $conn);
}