title: How to compare two datetime in mysql query using php
body: <p>I want to compare two <code>datetime</code> variable witch one of them is current <code>server time</code> and one of them is stored in <code>mysql</code> 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</p>
  
  <pre><code>    &lt;?php include("includes/student_session.php");?&gt;
  &lt;?php confirm_logged_in();?&gt;
  &lt;?php include("includes/connection.php");?&gt;
  &lt;?php 
          date_default_timezone_set("");
          $now_date=date("Y-m-d H:i:s");
  
      $query1="select exam_id from exam where {$now_date} &gt; start_date";
      $result=mysqli_query($cnn,$query1);
      if($result){
  
      $row=mysqli_fetch_array($result);
      echo $exam_id. "exists";
  
      }else
      {echo mysqli_error($cnn);}
  
  ?&gt;
  </code></pre>