Alright... Here is what I would do.
One table for each; the subject, the questions, the answers:
PHP Code:
CREATE TABLE tblSubject (
fldSubjectId SMALLINT(5) AUTO_INCREMENT UNSIGNED ZEROFILL,
fldSubject VARCHAR(the maximum length you think you will need),
PRIMARY KEY (fldSubjectId));
CREATE TABLE tblQuestions (
fldQuestionId MEDIUMINT AUTO_INCREMENT UNSIGNED ZEROFILL,
fldSubjectId SMALLINT(5) UNSIGNED ZEROFILL,
fldQuestion VARCHAR(the maximum length you think you will need),
fldQuestionYear SMALLINT(4),
PRIMARY KEY (fldQuestionId));
CREATE TABLE tblAnswers (
fldAnswerId MEDIUMINT AUTO_INCREMENT UNSIGNED ZEROFILL,
fldQuestionId MEDIUMINT UNSIGNED ZEROFILL,
fldAnswer VARCHAR(the maximum length you think you will need),
fldCorrect ENUM('N','Y'),
PRIMARY KEY (fldAnswerId));
Then in the form, use the identification numbers from the records for the values on the test. Then to test for the corrrect answer on a question, you would run a query like this:
PHP Code:
SELECT fldCorrect FROM tblAnswer WHERE fldQuestionId = [whatever variable you use to assign the question id to];
HTH
Bookmarks