title: get mysql data between two dates using php
body: <p>I am Trying to fetch Data between two dates, date was stored as <code>DATETIME</code> in mysql and showing as <code>2016-04-02 04:55:03</code></p>
  
  <p>to get dates I am using bootstrap datetimepicker with input form like below</p>
  
  <pre><code>&lt;div class="input-group date" id="datetimepicker1"&gt;
       &lt;input type="text" class="form-control" id="checkin" name="from_date" data-date-format="dd/mm/yyyy" placeholder="Select Start Date"&gt;
        &lt;span class="input-group-addon"&gt;&lt;i class="glyphicon glyphicon-calendar"&gt;&lt;/i&gt;&lt;/span&gt;
     &lt;/div&gt;
     &lt;div class="gap-small"&gt;&lt;/div&gt;
     &lt;div class="input-group date"&gt;
         &lt;input type="text" class="form-control datechange" id="checkout" name="to_date" data-date-format="dd/mm/yyyy" placeholder="Select End Date"&gt;
         &lt;span class="input-group-addon"&gt;&lt;i class="glyphicon glyphicon-calendar"&gt;&lt;/i&gt;&lt;/span&gt;
     &lt;/div&gt;
  </code></pre>
  
  <p>and i am using AJAX to send these values to PHP.</p>
  
  <p>in result page:</p>
  
  <pre><code>var_dump($_POST)
  </code></pre>
  
  <p>result:</p>
  
  <pre><code>    array(3) { ["from_date"]=&gt; string(10) "30/03/2016" ["to_date"]=&gt; string(10) "05/04/2016" ["search_place"]=&gt; array(1) { [0]=&gt; string(0) "" } }
  </code></pre>
  
  <p>i am getting values in <code>from_date</code> and <code>to_date</code></p>
  
  <p>now when i am trying to retrive between from and to dates its not working below is my sql statement</p>
  
  <pre><code>$sql="SELECT * FROM mytable WHERE evedate BETWEEN '" . $from_date . "' AND  '" . $to_date . "'";
  </code></pre>