title: Select rows between two dates where dates are variables
body: <p>I have an SELECT statement in php and I need to select all rows of the table where the "date" column is in between a start date and end date that will be defined by variables.</p>
  
  <p>I have this working perfectly fine when I define the dates directly in the SELECT statement as shown below:</p>
  
  <pre><code>date BETWEEN "2015-02-03" AND "2015-02-05"
  </code></pre>
  
  <p>However, when I try to do the same thing but with variables, it doesn't seem to work:</p>
  
  <pre><code>date BETWEEN "$startdate" AND "$enddate"
  </code></pre>
  
  <p>Where</p>
  
  <pre><code>$startdate = "2015-02-03";
  $enddate = "2015-02-05";
  </code></pre>
  
  <p>Hope all this makes sense, Cheers in advance.</p>
  
  <p>Full code snippet is here as requested:</p>
  
  <pre><code>$startdate = "2015-02-03";
  $enddate = "2015-02-05";
  
  $sql = 'SELECT record_number, date, manmod, description, cal, serial, datein, dateout, retdate, refex, refexdate, sellersname, sellersaddress, buyersname, buyersaddress, rfddealer, del, warranty, months FROM record WHERE del="Live" AND date BETWEEN "$startdate" AND "$enddate" ORDER BY record_number DESC';
  </code></pre>