title: How to compare start and end date with current date in php?
body: <pre><code>while($row = mysqli_fetch_array($sql))
  {
      $start_date = strtotime($row['start_date']);
      $end_date = strtotime($row['end_date']);
      $current_date = strtotime(date('Y-m-d'));
  
      if($start_date &lt;= $current_date &amp;&amp; $end_date &gt;= $current_date)
      {
          echo "&lt;a href='javascript:void(0)' class='btn btn-success'&gt;Start&lt;/a&gt;";
      }
      else
      {
          echo "&lt;a href='javascript:void(0)' class='btn btn-danger'&gt;Over&lt;/a&gt;";
      }
  }
  </code></pre>
  
  <p>In this code I have two rows where in my first row <code>start_date = 2019-12-13</code> and <code>end_date = 2019-12-20</code> and second row has <code>start_date = 2019-12-12</code> and <code>end_date = 2019-12-15</code>. Now, I am simply compare start and end date with current date and show message <code>start</code> and <code>over</code> but it always show me <code>start</code> message only. So, How can I correct if start and end date is not matched with current date.</p>