$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 //Grab password to verify it. Also grab idUsers, first name, last name and UID to use later
 $query = "SELECT password, idUsers, first_name, last_name, uID FROM Users WHERE username = :username";
 $stmt = $dbh->prepare($query);
 $stmt->bindParam(':username', $_POST['username'], PDO::PARAM_STR);
 $stmt->execute();
 //If the username exists, check the password
 if ($stmt->rowCount() > 0) {
     $result = $stmt->fetch();
     $dbPassword = $result['password'];
     if ($dbPassword == hash('sha256', $_POST['password'])) {
         //Now that the user is good to log in, unset all session variables except requestedPage
         clear_session_variables();
         //Then populate the user object
         $user = new User();
         $user->set_uid($result['uID']);
         $user->set_first_name($result['first_name']);
         $user->set_last_name($result['last_name']);
         //Store the user's UID in a session variable for easy access
         $_SESSION['uid'] = $result['uID'];
         //Now assign the user their roles
         $query = "SELECT role FROM Roles WHERE idUsers = :idUser";
         $stmt = $dbh->prepare($query);
         $stmt->bindParam(':idUser', intval($result['idUsers']), PDO::PARAM_INT);
         $stmt->execute();
         $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
         //Now add the user's roles to the User object
         foreach ($result as $row) {
             echo "I'm adding this: " . $row['role'];
             $user->add_role($row['role']);
         }
     * Next, we'll need to find the TAs that have requested to TA for this course this semester and year
     */
    $query = "SELECT DISTINCT U.uID, U.first_name, U.last_name, TA.class_request, TA.recommend\n              FROM Users U, TA_Applicants TA\n              WHERE U.uID = TA.uID AND TA.class_request = :catNum AND semester = :semester AND year = :year\n              ORDER BY TA.recommend DESC";
    $stmt = $dbh->prepare($query);
    $stmt->bindValue(':catNum', $courseNum, PDO::PARAM_INT);
    $stmt->bindValue(':semester', $semester, PDO::PARAM_STR);
    $stmt->bindValue(':year', $year, PDO::PARAM_INT);
    $stmt->execute();
    $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
    //Create an array to hold all of the User objects
    $taArray = [];
    foreach ($result as $row) {
        //Create a new user object
        $currentUser = new User();
        //Set the available variables
        $currentUser->set_uid($row['uID']);
        $currentUser->set_first_name($row['first_name']);
        $currentUser->set_last_name($row['last_name']);
        $currentUser->set_class_request($row['class_request']);
        $currentUser->set_recommend($row['recommend']);
        //Add the object to correct array
        $taArray[] = $currentUser;
    }
    $dbh = null;
} catch (PDOException $e) {
    print "Error!:" . $e->getMessage() . "<br/>";
    die;
}
/*
 * Now that all of the information has been gathered from the database, we can use it to generate some html.
 *