If i do this in MYSQL it works:
SELECT * FROM reservations
WHERE
reservationStartDate >= '2018-01-01'
AND
reservationEndDate <= '2018-02-16'
AND
reservationSpace = 'kantoor-1'
So i want to make a function like this:
public function checkReservations($startdate, $enddate, $workspace, $bind="") {
//SELECT * FROM reservations WHERE reservationStartDate >= '2018-01-19' AND reservationEndDate <= '2018-02-01' AND reservationSpace = 'kantoor-1';
// Date format = 2018-12-31
$sql = "
SELECT * FROM DATABASENAME.reservations
WHERE
reservationStartDate >= '".$startdate."'
AND
reservationEndDate <= '".$enddate."'
AND
reservationSpace = '".$workspace."'
"
;
$this->run($sql,$bind);
}
And in php i use:
$test2 = $db->checkReservations('2018-01-01', '2018-02-16', 'kantoor-1');
echo '<pre>'.print_r($test2,true).'</pre>';
It show's nothing... Im almost there btw i have change the format of the date to Y-m-d