On my website, after a dateselection, the date is given to the server by an AJAX post call. The format before handing it over looks like this: 08/09/2018 08/24/2018
According to the XHR in my debugging console, the payload when returning these dates from the serverside looks like this: ["08/09/2018","08/24/2018"]
Now, I must admit that I dont know what exactly these dates look like while they "live" inside the php script called by my AJAX. But I guess they look at least somehow like the payload.
however, I inside this called php script, the date coming from the javascript is compared to one I get from the database. The date coming from the database looks a bit different, like this: 2018-06-04 00:00:00
Now, does a comparison (with ">" or "<" for example) work while using these two different formats? Or do I need to unify the format before the comparison? If so, how can I do that? Currently, the comparison implemented inside this php script doesnt work, but I dont know whether this is due to another bug or due the formal differences between the dates.
The MYSQL Code doing the comparison inside my php script looks like this.
$options = $connection->query("
select arb.nummer
from arbeitsplatz arb
LEFT JOIN (
SELECT res.arbeitsplatz
FROM reservierung res
WHERE (res.anfang >= '".$start."' AND res.anfang <= '".$ende."')
OR (res.ende >= '".$start."' AND res.ende <= '".$ende."')
OR (res.anfang <= '".$start."' AND res.ende >= '".$ende."')
AND (res.status = 'angefragt' OR res.status='belegt')
) AS respre
ON arb.id = respre.arbeitsplatz
WHERE respre.arbeitsplatz IS NULL
AND arb.aktiv = 1
AND arb.raum = '".$raum."'
AND (arb.art = '".$art."'
OR art = 'beides')
ORDER BY arb.nummer ASC");
edit: sry the first post lacked some of the MYSQL code.