1

Sorry for asking again guys. But i didn't gets the logic of my problem. I don't know if my solution is in the query or in the PHP codes but i guess this is in the query. This is the inserted data in mysql.

  BookingID     Name           CheckIn             CheckOut
      1       Dona       2017-08-08 00:00:00   2017-08-10 00:00:00
      2       Kier       2017-08-10 00:00:00   2017-08-15 00:00:00
      3       Patrick    2017-08-07 00:00:00   2017-08-11 00:00:00

This is my query.

   $CheckIn = "2017-08-08";
   $CheckOut = "2017-08-10";
$query =  mysqli_query($conn, "SELECT * FROM tblbooking WHERE (CheckIn BETWEEN '$CheckIn 00:00:00' AND '$CheckOut 00:00:00')");

This is the Output.

      BookingID     Name           CheckIn             CheckOut
          1       Dona       2017-08-08 00:00:00   2017-08-10 00:00:00
          2       Kier       2017-08-10 00:00:00   2017-08-15 00:00:00

But i want is will display all inserted value with the date of 8 to 10 inside of it.

Ex. BookingID = 3 CheckIn 2017-08-07 Checkout 2017-08-11 in my query i send between date of 8 to 10 so it means it will not display but i want to display it because it has the date of 8 to 10. Help me please :(.

1 Answers1

-1

You may Try it

$CheckIn = "2017-08-08";
$CheckOut = "2017-08-10";

$sql = "SELECT * FROM tblbooking WHERE `CheckIn` > '".$CheckIn."' AND `CheckIn` < '".$CheckIn."' AND `CheckOut` > '".$CheckOut."' AND `CheckOut` < '".$CheckOut."' ";

$query =  mysqli_query($conn, $sql);
vjy tiwari
  • 843
  • 1
  • 5
  • 17