I have the following php select sql statement, which I can not get it to work. Please help:
$sql = "SELECT student_email, student_id, grades_id FROM student_table WHERE email_alert = 1 AND class_grade >= '$var' AND student_id in (
select student_id
from student_alerts
where CURRENT_TIMESTAMP < student_grad_date)" ;
In this SQL $var = 85, student_id is a primary key in student_table and a foreign key in the student_alerts table. Also student_id is referenced to the primary key in the student_table. I believe the error might be somewhere around CURRENT_TIMESTAMP, the goal of which is to compare if today's date is not past the student's graduation date or it might be something in the syntax that I can not catch.
Thank you!
AND class_grade >= ".$var.".. If its not working maybe the connection or other factors, also another tip try to learn about Prepared Statements and why is it necessary...