is it possible to insert the time table in database?
time table in database
Collapse
X
-
-
Hi.
Check out the Date and Time types, as well as the Date and Time functions.
When you have two dates in your database, like for example a start and a end date, then you can use the WHERE .. BETWEEN syntax to see if they intersect.
Like, for example:
[code=sql]SELECT * FROM timeTable WHERE NOW() BETWEEN startDate AND endDate[/code]Comment
-
Could you show us how your current database looks like?
It's kind of hard to see a solution if you can't see the problem ^^
Assuming you already have a table containing the lecture rooms, I would create a second table for the time table. The second table would reference the Primary Key of the first table, so that we know which room we are referring to. I would also create start_time and an end_time Time columns.
This is assuming you want only the Time stored, but not the date.
If you do want the date as well, use the DateTime type instead.
Then you could insert a row into the second table every time each room is reserved, and you could use the query I posted earlier to see if a given time is reserved or not.Comment
-
Ok.
I'm not entirely sure we are talking about the same thing.
Just so I know what page you are on, tell me...
How would you go about getting data from your database?
Do you use some sort of GUI application?
Or do you use the command line interface?
How much experience do you have with SQL databases?
Have you worked with them a lot or are you new to it?Comment
-
Originally posted by alisyah,... so my lecturer want me to insert the lecture room schedule in database.....
But reading your posts I am not so confident that you have that expertise. Maybe it is wiser to do some (PHP) MySQL tutorials to get a better grasp on the matter at hand. See the following links:
MySQL introduction
Beginning-MySQL-Tutorial
PHP/MySQL Tutorial
MySQL starter
PHP tutorials
PHP-MySQL tutorial
RonaldComment
-
hi again..
to atli : actually i not really have experience with SQL database.i've learned all of this stuff a few months ago.our lecturer just teaching by theoretical.the y didn't show how to do it..so it's kinda hard to understand..i have no idea whether me use GUI application or command line interface..i already ask my lecturer,and she said the whole time table is not possible to insert in database.
to Ronald : thanks for your help.this is not only my class work u know..my final project..actual ly we not really learned the programming and database in class..then this final semester we need to build a website.
actually we need to submit our project by 28th May 08.Comment
Comment