title: Delete records after 15 minutes
body: <p>I've got an inactive system. It is supposed to delete users from inactive table after 15 minutes.
  I have also a code that logs the user out if it cant be found in that table.
  The inactive script updates user on every page refresh.</p>
  
  <p>This is the inactive code I tried and it doesn't work so far:</p>
  
  <pre><code>$result = mysqli_query($con,"SELECT * FROM inactive");
  
  while($row = mysqli_fetch_array($result))
  
  if ($row['inactive'] &gt; timestampadd(MINUTE, -15, now()))
    {
  
  
  
      }else {
  
  $db_query = "DELETE FROM inactive WHERE username='$username'";
  $result = mysql_query($db_query);
  
  
      }
  </code></pre>