CourseCreditsSemesterTaken Prior Degree"; //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 { //allows variables to be used out of scope global $currCognCourses; $currCognCourses = mysqli_fetch_all($currentCognClasses,MYSQLI_ASSOC); //while there are Cogn 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 completed //if so, the box will be prefilled with yes, no otherwise $takenCognQuery = "SELECT completed FROM CognateHistory WHERE studentID = " . $studentID . " AND courseID = '" . $currCognCourses[$count]['courseID'] . "'"; $takenCognResult = mysqli_query($connect, $takenCognQuery); $takenCogn = mysqli_fetch_array($takenCognResult,MYSQLI_ASSOC); $semesterCognQuery = "SELECT semester FROM CognateHistory WHERE studentID = " . $studentID . " AND courseID = '" . $currCognCourses[$count]['courseID'] . "'"; $semesterCognResult = mysqli_query($connect, $semesterCognQuery); $semesterCogn = mysqli_fetch_array($semesterCognResult,MYSQLI_ASSOC); echo "" . $currCognCourses[$count]['courseID'] . "\n" . "" . $credits['credits'] . "\n". ""; //start of semester echo "\n"; //end of semester echo "\n" . "\n"; } echo "\n"; } } ?>