From 48cff9c8d98c0477e5956bc88ba2924dd57eaff1 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Sat, 19 Aug 2023 21:11:48 +0800 Subject: [PATCH] Admin.php: remove dash before TA name (if any). If no TA is available, show 'None' instead of leaving it empty. --- Courses.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Courses.php b/Courses.php index b07e720..d5aa6bb 100644 --- a/Courses.php +++ b/Courses.php @@ -377,28 +377,30 @@ course_ta ON course_ta.Course_ID=courses_table.Course_ID where course_ta.TA=$use if(mysqli_num_rows($result) != 0) { while($row = mysqli_fetch_assoc($result)) { - $id=$row['Course_ID']; - $name=$row['Course_Name']; - $code=$row['Course_Code']; - $faculty=$row['Faculty']; - $lecturer=$row['Full_Name']; - $academic=$row['Academic_Year']; - $url=$row['URL']; + $id = $row['Course_ID']; + $name = $row['Course_Name']; + $code = $row['Course_Code']; + $faculty = $row['Faculty']; + $lecturer = $row['Full_Name']; + $academic = $row['Academic_Year']; + $url = $row['URL']; - $resultTA = mysqli_query($con,"SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta` -INNER JOIN users_table on users_table.User_ID=course_ta.TA -where course_ta.Course_ID=$id"); + $resultTA = mysqli_query($con,"SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta` INNER JOIN users_table on users_table.User_ID=course_ta.TA where course_ta.Course_ID=$id"); - $ta=""; + $ta = ""; while($rowTA = mysqli_fetch_assoc($resultTA)) { - $ta=$ta." - ".$rowTA['TA_NAME']; + $ta = $ta." ".$rowTA['TA_NAME']; + } + + if ($ta == "") { + $ta = " None"; } echo"
($code) - $name -

Faculty: $faculty        Year: $academic        Lecturer:$lecturer        TA:$ta

+

Faculty: $faculty        Year: $academic        Lecturer: $lecturer        TA:$ta

";