I need to get the selected time range from the a mySQL database but I’m really struggling… Basically – The list of times are:
id Start End
1 2:00 3:00
2 3:00 4:00
3 4:00 5:00
I selected:
2:00 3:00
3:00 4:00
I want to get the id of the selected dates
Here is what I have tried:
SELECT id FROM DB WHERE start_time BETWEEN '$from_time' AND '$to_time';
But the code doesn’t work, it only gets the selected 2:00 - 3:00 time and not the 3:00 - 4:00 time.
When I try:
SELECT id FROM DB WHERE start_time >= '$from_time' AND to_time <= '$to_time';
I get NO resutls… Please help..
Try this: