Help with coding, it's for work

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

  • rukiya
    replied
    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

    Leave a comment:


  • GumSlone
    replied
    `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)

    Leave a comment:


  • rukiya
    replied
    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

    Leave a comment:


  • GumSlone
    replied
    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.

    Leave a comment:


  • Quintin
    started a topic Help with coding, it's for work

    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.
Working...
X