You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND courses_idcourses =' at line 1
Please check the following query-
SELECT * FROM temp_student_grade WHERE users_idusers = AND courses_idcourses =