Answer the question
In order to leave comments, you need to log in
Request a sample of the work of the store
Good evening! There is a structure that stores the time of the store:
ID | time_start (hour number) | time_stop (hour number) | day_start (number of the day of the week) | day_stop (sequential number of the day of the week) |
---|---|---|---|---|
one | 12 | one | 7 | 4 |
2 | 12 | 2 | 5 | 6 |
Answer the question
In order to leave comments, you need to log in
maybe then it’s better to change the structure of the table, for example
day-time - activity
0-0-0
0-6-1
0-22-0
1-6-1
...
well, change the number of the day of the week to a date to the heap (let's say + to 0001 -01-01 00:00:00). And then fasten the regulated calendar, as in 1sk ...
$now = current time;
$day = current day;
SELECT * FROM shop WHERE time_start>=$now AND time_stop<=$now AND day_start>=$day AND day_end<=$day
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question