SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Location
    montreal, quebec, canada
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    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.

    ------------------
    Marty P
    marty@tinytin.com
    http://tinytin.com

    "Speak as though I know nothing but am capable of understanding everything."

  3. #3
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •