From 1cac6bebea9dba1e7ed6d5459c4b66b0c6e2f36f Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 7 Sep 2023 19:49:35 +0800 Subject: [PATCH] Courses.php: improve search logic --- Courses.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Courses.php b/Courses.php index 688086e..7820623 100644 --- a/Courses.php +++ b/Courses.php @@ -506,27 +506,26 @@ include 'Header.php'; Search results for course code: $search
"; - $result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`," + echo "

Search results for course code: $search


"; + $result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`," . " `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` " . " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table" . " ON users_table.User_ID=courses_table.Lecturer_User_ID where Academic_Year >= $oldest_academic_year and Course_Code like '%{$search}%' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id) order by Academic_Year desc"); } // the user has entered something under "Find course by Code" - else + else if ($faculty != "") { echo "

Find courses under faculty: $faculty

"; $result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`,