";
//checking that the queries are valid
if(!mysqli_query($connect,$queryCurrDegreeCogn) && mysqli_query($connect,$queryCurrDegreeCogn) != NULL) {
printf("Error with first query: %s\n", mysqli_error($connect));
exit();
//if valid queries, do the good stuff
} else {
global $currCognCourses;
$currCognCourses = mysqli_fetch_all($currentCognClasses,MYSQLI_ASSOC);
//while there are cognate classes to add
for($count = 0; $count < sizeof($currCognCourses); $count++) {
//gets the credits associated with that class
$queryCredits = "SELECT credits FROM Courses WHERE courseID = '" . $currCognCourses[$count]['courseID'] . "'";
$creditsResult = mysqli_query($connect, $queryCredits);
$credits = mysqli_fetch_array($creditsResult,MYSQLI_ASSOC);
//checking if the course was part of the degree they took
//if so, the box will be prefilled with yes, no otherwise
if(in_array($currCognCourses[$count]['courseID'],$prevAllCourses)){
$taken = "Yes";
$selected = "selected = 'selected'";
} else {
$taken = "No";
$selected = " ";
}
//makes user enter a semester for the class
$semester = "\n";
echo "