$level_sql_switch = mysqli_query($conn, "SELECT course_period_id
FROM course_periods
WHERE school_id = '$campus'
AND short_name = '$level'");
$course_period_id = $level_sql_switch->fetch_assoc();
$course_period_id = $course_period_id['short_name'];
For Example, when the excel file is read, the variable $level stores the value "C1". I would like to return a C1-T from the database using a select statement. How would you do so while ruling out the other variants of C1 (C1-A, C1-B, C1-C, C1-T2 and etc). As you cannot simply set the short_name = '$level' or use a substring.
"SELECT course_period_id FROM course_periods WHERE school_id = '$campus' AND short_name = '$level'"