CourseCreditsSemesterTaken Prior Degree"; //checking that the queries are valid if(!mysqli_query($connect,$queryCurrDegreeElect) && mysqli_query($connect,$queryCurrDegreeElect) != NULL) { printf("Error with first query: %s\n", mysqli_error($connect)); exit(); //if valid queries, do the good stuff } else { global $currElectCourses; $currElectCourses = mysqli_fetch_all($currentElectClasses,MYSQLI_ASSOC); //while there are elective classes to add for($count = 0; $count < sizeof($currElectCourses); $count++) { //gets the credits associated with that class $queryCredits = "SELECT credits FROM Courses WHERE courseID = '" . $currElectCourses[$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($currElectCourses[$count]['courseID'],$prevAllCourses)){ $taken = "Yes"; $selected = "selected = 'selected'"; } else { $taken = "No"; $selected = " "; } //makes user enter a semester for the class $semester = "\n"; echo "" . $currElectCourses[$count]['courseID'] . "\n" . "" . $credits['credits'] . "\n". "" . $semester . "\n" . "\n"; } echo "\n"; } } ?>