I have a MySQL database SELECT with a variable that is a date. It does not return a row with an equal value, however when I hardcode the value, it does return a row:
$q is a UNIX timestamp
$timeslotDate = date("Y-m-d", $q + 60 * 60 * 4); // 0000:00:00 format
DOES NOT WORK:
$results = $mysqli->query("SELECT timeslot_time FROM wp_pickup_timeslots WHERE timeslot_date = $timeslotDate");
DOES WORK - Hardcoded date
$results = $mysqli->query("SELECT timeslot_time FROM wp_pickup_timeslots WHERE timeslot_date = '2020-05-23'");
MySQL table:
Fields: timeslot_ID (int), timeslot_date (date), timeslot_time (time)
Values: 0000001, 2020-05-23, 10:30:00.000000
I tried a few things, figuring this is a string, integer, time issue. Just can't figure it out. If anyone has and input into my problem, I would be appreciative!