SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2011
    Location
    Colorado, USA
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Php Sql Schedule

    I'm starting a new project for a company I work for not sure if they will end up using it or not. I am not a programmer but am working on learning it. I have been asked to make a php/sql schedule for the rink to display all the events for the day. So far I have my database set up with the following columns: date, event, event_title, start_time, end_time, team_one, team_one_lr, team_two, team_two_lr. All of the datatypes are set at varchar since I am not to familiar with all the other types.

    The problem I am trying to solve atm is when adding events to the schedule how do I check to make sure the times do not conflict? Its not a huge issue but I would like a warning to pop up if someone try's to add a event that conflicts with something already in the DB.

    Another issue I am trying to solve is when displaying the events for the day I want the event's that have all ready taken place to no longer be displayed. Ex. If a game ends at 10:00 at 10:10 I want the event to be taken off. I think I know how to get the page to refresh every time minutes using this
    PHP Code:
    header("Refresh: 600; url='\condition\index.php'"); 

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,832
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    You would accomplish what you want using SQL queries, not in PHP.

    There are different ways you could do what you want to do. For example, you could run a query to see if there is an existing reservation and if so, output a notice indicating a message indicating such.

    If you want to make sure old events are not showing, you would run a query selecting the upcoming events for today where the time of the event is greater than the current time.

    You should also put a unique ID field in your table, unless the event serves as the unique ID.

  3. #3
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    When considering any kind of calendaring system you must appreciate that Mysql DATE and TIME fields offer far superior possibilities when you can see you will be querying for dates/times.

    http://dev.mysql.com/doc/refman/5.5/...functions.html


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
  •