Help with coding, it's for work

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with coding, it's for work

    I need urgent help.

    See what I'm working on is a webiste for the students of the collage that i work on.

    Now, I need to store 100+ exams in a database, with questions and answers, the student writes the exam online, mostly true & fals questions, then a b c or d questions.

    After the students has written theyr exams, theyr resaults should display.

    Someone maybe has an idea how i should do it?

    Please help would be aprisiated.



    I thought of a few stuff, but i'd prefer the database to be very compact, now i just want to know how you guys think i must do it.

    #2
    are the answers for exam questions in multiple choise form?

    because if they are not then youll need a human to check if the answer is correct.

    i would use a different tables for questions and the possible answers, and you should take a look at some other existing online exam forms, how they were done.
    Advertise your mobile site for FREE with AdTwirl

    Comment


      #3
      Both for true false and a b c d multiple choice question input correct answer in the database then check student's answer comparing with the database. publish the match result. Use radio button for choosing only one correct answer and checkbox for choosing multiple correct ansers in html form.

      database table is like this

      PHP Code:
      CREATE TABLE `answers` (
        `
      questionidint(10NOT NULL PRIMARY KEY,
        `
      answerchar(1NOT NULL default '',
      ENGINE=MyISAM DEFAULT CHARSET=utf8

      Comment


        #4
        `questionid` int(10) NOT NULL PRIMARY KEY,
        Bad idea to use a primary key, because a question id can have more answers and if you have the table like this you can have only one answer to every question id

        i would create tables like this

        questions:

        id (integer primary key auto increment)
        question (question text)

        answers
        id (integer primary key auto increment)
        question_id (integer index)
        answer (possible answer text)
        correct (if answer is correct true else it should be false)
        points (number of points to give/substract for correct/incorrect answer)
        Advertise your mobile site for FREE with AdTwirl

        Comment


          #5
          Ok then
          PHP Code:
          CREATE TABLE `answers` ( 
            `
          idint(10NOT NULL auto_increment PRIMARY KEY,
            `
          questionidint(10NOT NULL 
            `
          answerchar(1NOT NULL default ''
          ENGINE=MyISAM   AUTO_INCREMENT=DEFAULT CHARSET=utf8

          Comment


            #6
            Originally posted by rukiya View Post
            Ok then
            PHP Code:
            CREATE TABLE `answers` ( 
              `
            idint(10NOT NULL auto_increment PRIMARY KEY,
              `
            questionidint(10NOT NULL 
              `
            answerchar(1NOT NULL default ''
            ENGINE=MyISAM   AUTO_INCREMENT=DEFAULT CHARSET=utf8
            and how will you know if the answer is correct?
            you need to add additional row,
            eg. correct = true or correct = false
            Advertise your mobile site for FREE with AdTwirl

            Comment


              #7
              Gum dont brofther to tech rukiya how to do things right lol he a noob bro:D
              Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
              Visit: WapMasterz Coming Back Soon!
              _______
              SCRIPTS FOR SALE BY SUBZERO
              Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
              FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
              _______
              Info & Tips
              php.net
              w3schools.com

              Comment


                #8
                Originally posted by subzero View Post
                Gum dont brofther to tech rukiya how to do things right lol he a noob bro:D
                we were all noobs
                Advertise your mobile site for FREE with AdTwirl

                Comment


                  #9
                  he going around thinks a big shot lol

                  Yeah we all where a leaner once but when it comes to newbies like him always thinks big

                  lol i also found a error with his sql but i keep to my self with this lol
                  Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                  Visit: WapMasterz Coming Back Soon!
                  _______
                  SCRIPTS FOR SALE BY SUBZERO
                  Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                  FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                  _______
                  Info & Tips
                  php.net
                  w3schools.com

                  Comment


                    #10
                    Originally posted by subzero View Post
                    he going around thinks a big shot lol

                    Yeah we all where a leaner once but when it comes to newbies like him always thinks big

                    lol i also found a error with his sql but i keep to my self with this lol
                    the answer char(1)?
                    ok it should be text or varchar(255)
                    Advertise your mobile site for FREE with AdTwirl

                    Comment


                      #11
                      Any over 100 it comes to auto text file in sql ;)
                      Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                      Visit: WapMasterz Coming Back Soon!
                      _______
                      SCRIPTS FOR SALE BY SUBZERO
                      Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                      FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                      _______
                      Info & Tips
                      php.net
                      w3schools.com

                      Comment


                        #12
                        Originally posted by GumSlone View Post
                        and how will you know if the answer is correct?
                        you need to add additional row,
                        eg. correct = true or correct = false
                        Gumslone Its easy like this

                        INSERT INTO `answers` VALUES (1,1,'0');
                        INSERT INTO `answers` VALUES (2,2,'a');
                        INSERT INTO `answers` VALUES (3,2,'c');

                        I would insert the correct answers only in the table.

                        if its true false answe then for true value=1 and false=0
                        question 1
                        student answered true=1 but in the table its false=0

                        question 2
                        student answered a,d but in the table its a,c

                        Its really a easy sql thing.



                        And subzero I know what type of stupid coding you know, noob,you 1st learn how to write english correctly.
                        Last edited by rukiya; 28.03.09, 12:54.

                        Comment


                          #13
                          Originally posted by GumSlone View Post
                          the answer char(1)?
                          ok it should be text or varchar(255)
                          No its just char(1) I showed you example

                          Comment


                            #14
                            Originally posted by rukiya View Post
                            Gumslone Its easy like this

                            INSERT INTO `answers` VALUES (1,1,'0');
                            INSERT INTO `answers` VALUES (2,2,'a');
                            INSERT INTO `answers` VALUES (3,2,'c');

                            I would insert the correct answers only in the table.

                            if its true false answe then for true value=1 and false=0
                            question 1
                            student answered true=1 but in the table its false=0

                            question 2
                            student answered a,d but in the table its a,c

                            Its really a easy sql thing.
                            ok if you would do this way its your choice, but i wouldnt do it like this
                            Advertise your mobile site for FREE with AdTwirl

                            Comment


                              #15
                              Originally posted by GumSlone View Post
                              are the answers for exam questions in multiple choise form?

                              because if they are not then youll need a human to check if the answer is correct.

                              i would use a different tables for questions and the possible answers, and you should take a look at some other existing online exam forms, how they were done.
                              Yes it is multiple choise form gums

                              Comment

                              Working...
                              X