time table in database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alisyah
    New Member
    • May 2008
    • 9

    time table in database

    is it possible to insert the time table in database?
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Welcome to Bytes!

    What is 'time table' in your question? Please explain.

    Ronald

    Comment

    • alisyah
      New Member
      • May 2008
      • 9

      #3
      i made a website bout reservation for lecture room.then i need to detect the room whether it's available or not.so my lecturer want me to insert the lecture room schedule in database.then i need to create section 'search' by time(lecture room).

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        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

        • alisyah
          New Member
          • May 2008
          • 9

          #5
          hi too
          to atli : i'm sorry..i really don't understand that..can u explain a lil bit more and a lil bit easy for me to understand..tq for helping me.

          my question :how to insert the time table in database?

          Comment

          • Atli
            Recognized Expert Expert
            • Nov 2006
            • 5062

            #6
            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

            • alisyah
              New Member
              • May 2008
              • 9

              #7
              hi again..
              to atli : thanks for your help..but it's kinda hard for me to understand the explanation.i totally can't imagine how to do that.
              i also dunno how to show my database in this forum.

              Comment

              • Atli
                Recognized Expert Expert
                • Nov 2006
                • 5062

                #8
                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

                • ronverdonk
                  Recognized Expert Specialist
                  • Jul 2006
                  • 4259

                  #9
                  Originally posted by alisyah
                  ,... so my lecturer want me to insert the lecture room schedule in database.....
                  I assume you want us to help you with your school/class work. I also assume that your lecturer thinks you have the (theoretical) programming and database background to achieve this, otherwise you would not have gotten this assignment?

                  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

                  Ronald

                  Comment

                  • alisyah
                    New Member
                    • May 2008
                    • 9

                    #10
                    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

                    Working...