title: Check if the start and end date entered is between the already start and end date in database
body: <p>I am making the booking script for rent a car. User will enter two dates at the time of booking, start date and end date, what i need that it checks that the entered dates are between the dates that are already stored in the Db for that specific car, 
  In simple words, if car is booked from 2015-23-08 to 2015-25-08, and user entered the dates between these two its shows an error other wise the order should be placed.</p>
  
  <p><strong>Issue in code: it always shows me "in between" even i entered different values</strong></p>
  
  <p>Code: </p>
  
  <pre><code>include 'connection.php';
  if (isset($_GET['id'])) {
  // escape variables for security
  $fleettype = $_POST['fleettype'];
  $fleetname = $_POST['fleetname'];
  $fleetclass = $_POST['fleetclass'];
  $fleetdescription = $_POST['fleetdescription'];
  $fleetprice = $_POST['fleetprice'];
  $username = $_POST['username'];
  $useremail = $_POST['useremail'];
  $userphone = $_POST['userphone'];
  $sdate = $_POST['sdate'];
  $edate = $_POST['edate'];
  $time = $_POST['time'];
  $driver = $_POST['driver'];
  $useremail = $_POST['useremail'];
  $id = preg_replace('#[^0-9]#i', '', $_GET['id']);
  $products = mysqli_query($con, "SELECT * FROM fleet WHERE id='$id' LIMIT 1 ");
  while ($row = mysqli_fetch_assoc($products))
  { 
  
           $stime = $row["stime"];
           $etime = $row["etime"];
           }
  
  
  $entereddate = DateTime::createFromFormat('Y/m/d', $stime);
  $contractDateBegin = DateTime::createFromFormat('Y/m/d', $sdate);
  $contractDateEnd = DateTime::createFromFormat('Y/m/d', $edate);
  
  
  if ($entereddate &gt;= $contractDateBegin &amp;&amp; $entereddate &lt;= $contractDateEnd)
  {
   echo "in between";
  }
  
  else {
    echo "no";
  }
  
  }   
  </code></pre>