SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question availability per hours and days

    I cannot find a script that would allow me to display different content (text or image) depending of the day of the week and the hour of the day.

    I need a back office to be able to manage operating hours by day and hours.
    Ideally using php+ mysql

    can anyone help me to find such a script?

  2. #2
    SitePoint Evangelist stonedeft's Avatar
    Join Date
    Aug 2009
    Posts
    589
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by breteuil View Post
    I cannot find a script that would allow me to display different content (text or image) depending of the day of the week and the hour of the day.

    I need a back office to be able to manage operating hours by day and hours.
    Ideally using php+ mysql

    can anyone help me to find such a script?
    This one is dependent on the structure of your mysql database. Maybe a field that will store hour and date and you will query it like...

    Select from table where time = time() and date = date()

    ...just an idea.
    Don't Panic

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stonedeft View Post
    Select from table where time = time() and date = date()
    Yes, thats properly the easiest way.

    You can use date("N") to give you the day of the week (1 - monday - 7 - sunday)
    and date("G") for the hour of the day (0 - 23)

  4. #4
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you all for your answers but I know which kind of php functions to use
    the problem is that i would like to setup specific hours for several different customers

    example
    > customer A : open on sunday from 9 am to 6 pm and on tuesday from 8 am to 7 pm
    > customer B : open on monday, tuesday, thrusday and friday from 10 am to 5 pm

    I have some ideas about the mysql structure but I would like some advices

    thanks

  5. #5
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in fact regarding the mysql structure I'm thinking about building an hourset which would be a row containing such columns

    > hourid
    > sunday
    > tuesday
    ...
    > saturday

    for each day I would store the hours where the business is open but i don't know which format is the best to use to be sure I cover all the hours
    please any idea submit.


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
  •