I am trying to fetch results between specific dates checkin and checkout. I am gettting the following error:
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '14:00:00 AND b.end <= 2016-03-31 11:00:00' at line 4
SELECT * FROM properties as a LEFT JOIN reservations as b ON b.room_id = a.room_id WHERE a.client = 7 AND b.start >= 2016-03-01 14:00:00 AND b.end <= 2016-03-31 11:00:00
Filename: controllers/Transactions.php
Line Number: 741
SQL:
$sql = "SELECT *
FROM properties as a
LEFT JOIN reservations as b ON b.room_id = a.room_id
WHERE a.client = $client AND b.start >= $start AND b.end <= $end";
$query = $this->db->query($sql);
The datetime is $start and $end.. what am i doing wrong? Thanks