SQL Where Date Condition
<p>I want get sales data on between the two dates but it does not work correctly SQL query.</p>

<p><a href="https://i.stack.imgur.com/KnMzR.png" rel="nofollow"><img src="https://i.stack.imgur.com/KnMzR.png" alt="saledate column"></a></p>

<pre><code>  if($_GET['startdate'])
  {
    $startdate = date('Y-m-d H:i:s', strtotime($_GET['startdate']));
  }
  else
  {
    $startdate = 'NOW()';
  }
  if($_GET['enddate'])
  {
    $enddate = date('Y-m-d H:i:s', strtotime($_GET['enddate']));
  }
  else
  {
    $enddate = date('Y-m-d H:i:s', strtotime('-1 month'));
  }
  $db-&gt;setTrace('true');

  $sales = $db-&gt;rawQuery('SELECT * from sales where (saledate BETWEEN ? AND ?) AND deletestat = ?',  [$startdate, $enddate, '0']);
  print_r($db-&gt;trace);
</code></pre>

<p>I am using <a href="https://github.com/joshcam/PHP-MySQLi-Database-Class#initialization" rel="nofollow">joshcam/mySQLi</a> class for sql queries. </p>

<p>How to get data on between the two dates?</p>