I want $teacherIDList to include the teacherID when it loops with the same courseID for example I want it to be ('RITC01','RITC01') but at the moment it is only ('RITC01').
PHP:
function getTeacherID($subjectID) {
require ('dbconnect.php');
$teacherIDSQL = mysqli_query($dbc,"SELECT teacherID FROM TeacherClassRoomCourse WHERE courseID = '$subjectID'");
$teacherIDList = [];
while($teacherID = mysqli_fetch_array($teacherIDSQL,MYSQLI_ASSOC)) {
array_push($teacherIDList, $teacherID['teacherID']);
return $teacherIDList;
}
}
getTeacherID('COMP12');
dbconnect.php contains $dbc which connects to the database.
TeacherClassRoomCourse table:
