I want to compare two datetime variable witch one of them is current server time and one of them is stored in mysql database i am running this simple piece of code and it wont work and says it is a syntax error i am wondering what can i do
<?php include("includes/student_session.php");?>
<?php confirm_logged_in();?>
<?php include("includes/connection.php");?>
<?php
date_default_timezone_set("");
$now_date=date("Y-m-d H:i:s");
$query1="select exam_id from exam where {$now_date} > start_date";
$result=mysqli_query($cnn,$query1);
if($result){
$row=mysqli_fetch_array($result);
echo $exam_id. "exists";
}else
{echo mysqli_error($cnn);}
?>
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 'query1' at line 1