title: Comparing dates in MySQL using PDO (PHP) not working using YYYY-mm-dd format
body: <p>I am trying to get records from between two dates using MySQL and PDO PHP.</p>
  
  <pre><code>SELECT * FROM tripTable AS trip
  WHERE trip.travelDate BETWEEN :startDate AND :endDate
  </code></pre>
  
  <p>This doesn't seem to work when using the <strong><em>$_POST</em></strong> date variables of <strong>1970-01-01</strong> and <strong>2099-01-01</strong> but works when I convert those to variables to <strong>19700101</strong> and <strong>20990101</strong> respectively.</p>
  
  <p><code>travelDate</code> is stored as date format.</p>
  
  <p><code>:startDate</code> being 1970-01-01 and <code>:endDate</code> being 2099-01-01</p>
  
  <p>Example PHP Code</p>
  
  <pre><code>$startDate = $_POST["startdate"];
  $endDate = $_POST["enddate"];
  
  $stmt = $dbh-&gt;prepare(/*above query*/);
  $stmt-&gt;bindValue(":startDate", $startDate, PDO::PARAM_STR);
  $stmt-&gt;bindValue(":endDate", $endDate, PDO::PARAM_STR);
  $stmt-&gt;execute();
  var_dump($stmt-&gt;fetchAll(PDO::FETCH_ASSOC))
  </code></pre>
  
  <p>Why is this and is there a way I can remedy this in my SQL query?</p>
  
  <p>I am testing the query using PhpStorm 2019.3.4's built in Query Console</p>