SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: Help Me On This Please!
-
Jul 20, 2003, 04:44 #1
- Join Date
- May 2003
- Location
- Kampala Uganda
- Posts
- 70
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Help Me On This Please!
Guess you know or hard of Cisco online examinations!
In my project am to implement some thing of that kind! i have done most and one part still failing where i need you help!
With lots of questions in a database each with a subject, 4 different objective answers,with the right Ans and a year of the question it was examined in an examination board. when some body selects the subject and year to do, then the respective questions are displayed using the while loop with for the sql statement
PHP Code:$sql = mysql_query("select * from questions where Subject = '$subject' and Year = '$year'")
Please Help me thanksAnd we know that all things work together for good
To them that love God, to them who are the called
According to his purpose. Romans 8:28
-
Jul 20, 2003, 06:44 #2
- Join Date
- Jul 2002
- Location
- Along the Wasatch Fault line.
- Posts
- 1,771
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If I understand you correctly, you have a subject on the test, under the subject you have several questions, under each question you have 4 different possible answers, and your question is, "How can I tell with the PHP script and mySQL which answer is the RIGHT one."
Do I understand you correctly?John
-
Jul 21, 2003, 19:19 #3
- Join Date
- May 2003
- Location
- Kampala Uganda
- Posts
- 70
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Right you do!
And we know that all things work together for good
To them that love God, to them who are the called
According to his purpose. Romans 8:28
-
Jul 21, 2003, 21:05 #4
- Join Date
- Jul 2002
- Location
- Along the Wasatch Fault line.
- Posts
- 1,771
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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));
PHP Code:SELECT fldCorrect FROM tblAnswer WHERE fldQuestionId = [whatever variable you use to assign the question id to];
John
-
Jul 24, 2003, 13:54 #5
- Join Date
- May 2003
- Location
- Kampala Uganda
- Posts
- 70
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks John agreat deal!
And we know that all things work together for good
To them that love God, to them who are the called
According to his purpose. Romans 8:28
Bookmarks