I wrote a SQL statement. It works on SQL workspace but if embedded in PHP, it doesn't work:
$xcourse = mysql_query("select result.student, result.course,
course.course_code, result.score,course.unit
from result
left join course on result.course = course.id
right join user on result.student = user.username
where result.level = $xlevel
and result.semester = $xsemester
and result.class = '$dept'
and result.year = '$xsession'
and user.specialization = '2'
order by result.student asc");
If values are inserted in SQL workspace, it will work. Please I will like to know what's wrong.