penguinsource Posted October 25, 2010 Share Posted October 25, 2010 I'm not completely sure how to implement this so I'd like to ask you to give me an idea if you can For a tennis booking system.. it will look something similar to (should be a table but this is for the sake of the idea) Date: Oct 25th, 2010 (go to oct 26) Court 1 Court 2 Court 3 Court 4 8:00 Open(bookit) Tally Open Hellio 9:00 Andy Roger Barney Training ...etc Now everyday, this table should be empty, so new bookings can be made how would I make it so a new table is empty /or has dif bookings every day (based on date) efficiently? Im guessing I will have dif values in the sql table for dif dates but what I'm not sure of is how to display it in page for ex, if someone presses the button oct 26, the new table is for that date, wif diff values Quote Link to comment Share on other sites More sharing options...
micah1701 Posted October 25, 2010 Share Posted October 25, 2010 eeek. that doesn't sound like a good database schema. within a year you'll have 365 tables in your database. you really just need a table with a few fields, like: ID (the incremental integer row identification number) date (the date that a court will be booked) start_time (the time that the court will be booked) end_time (the time that this booking ends) court (the court name - or better yet, the ID value to a court listed in another table of "courts") user (the user who has booked the court - or again, the ID value to a list of users and uses in another table) then, you can query your database any way you want. When is Court 3 being used on Oct 25? "SELECT `user` FROM table_name WHERE date = '2010-10-25' " Is Court 3 availabe at 2:45 on October 25? "SELECT `ID` FROM table_name WHERE date = '2010-10-25' AND start_time < 2:45 AND end_time > 2:45" etc... (and really, you don't need that `date` column either if the start and end time columns use a full date/time format) Quote Link to comment Share on other sites More sharing options...
penguinsource Posted October 25, 2010 Author Share Posted October 25, 2010 Yea that clarifies a part. Thanks But I'm also not sure about how to display the next booking date. As in, if i go to Next Day, how will I link to it (as in link to the booking day that has those set values)? I guess I can just use a condition like if day = select ..etc.. Anyway thanks for the fast answer, this sounds good! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.