title: Compare Date in sql table to current date
body: <p>I am working on a project in which the dates in the sql table needs to be checked with current date. If the ticket goes past the current date, then the status of ticket go from Active to Expired. <br>
  I am not good at php. This is what I came up with. I wrote this function at top of the page so that each time the page loads, it checks for the date and compares. date format is  <code>yyyy-mm-dd</code>.<br>
   What am I doing wrong. Can anyone please help me out?<br><br></p>
  
  <pre><code>   $result= "SELECT date, status FROM TABLE1";
  
     while($row = sqlsrv_fetch_array($result)){
  
     if(strtotime($row['date']) &gt; strtotime(date('Y-m-d'))){
  
  $updatequery = " UPDATE TABLE1 SET $row[status] = 'Expired' ";
  
  }}
  </code></pre>