Results 1 to 3 of 3
Thread: business hours and mysql entries
Jul 10, 2000, 17:00 #1
When someone accesses my site i want to be able to display either all of a category or only those businesses open. so this requires the entry of hours. then when a person selects "pizza" and it is 11:30, those already closed are not shown. how to handle the bars that open at 5 am and close at 2 am the following day is the question. any help?
Jul 10, 2000, 18:41 #2
- Join Date
- Jun 2000
- montreal, quebec, canada
- 0 Post(s)
- 0 Thread(s)
this is entirely a supposition, and i can't offer any code as i'm also just learning PHP and mySQL; but it would make sense to me that all the records you have in your mySQL have an "open" field and a "close" field, (those representing the hours of the businesses). from there you could have the script compare the open and close fields against the current time, (as gotten throught you PHP script), and display only those records which fall within appropriate parameters.
i know this will be of very little help to you if you are at the same level of PHP coding as i. perhaps i just posted this reply to see how far off my grasp of the concepts were. i hope that the reply's of more experienced folk will not only help you, but will validate my line of thought.
"Speak as though I know nothing but am capable of understanding everything."
Jul 11, 2000, 05:26 #3
i was not entirely clear when i filed the question.
yes, there is an open and close but the problem is when the open from one day overlaps into the next day. followed by a close and then by an open.
oh, i think i see. if it is after the open and before midnight and there is no close, then the business is open and if it is after midnight and before close, then it is open and if it is after close and before open then it is closed.
so instead of having open or closed, i also have a "midnight" condition.
when i have it working, i will share it.
thanks much ed