// this query is very similar to the above query, but it will check the session_rel_course_user table if there are courses registered to our user or not
FROM $tbl_session_course_user as session_course_user INNER JOIN $tbl_course AS course
ON course.code = session_course_user.course_code AND session_course_user.id_session = $id_session INNER JOIN $tbl_session as session ON session_course_user.id_session = session.id
INNER JOIN $tbl_session_course as session_course
LEFT JOIN $tbl_user as user ON user.user_id = session_course.id_coach
$personal_course_list_sql = "SELECT distinct course.code k, course.directory d, course.visual_code c, course.db_name db, course.title i, CONCAT(user.lastname,' ',user.firstname) t, email, course.course_language l, 1 sort, category_code user_course_cat, date_start, date_end, session.id as id_session, session.name as session_name, IF((session_course_user.id_user = 3 AND session_course_user.status=2),'2', '5')
FROM $tbl_session_course_user as session_course_user
INNER JOIN $tbl_course AS course
ON course.code = session_course_user.course_code AND session_course_user.id_session = $id_session
INNER JOIN $tbl_session as session ON session_course_user.id_session = session.id
LEFT JOIN $tbl_user as user ON user.user_id = session_course_user.id_user
WHERE session_course_user.id_user = $user_id ORDER BY i";