Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    I'm about to construct an online quiz for my collegues (job related, 3000 collegues)

    It's a systems quiz with 2000 questions ,and multiple choice answers to each question.

    Right now I have the text-file containing the thousands of questions and their accompanying multiple choice options. The problem (immediately) will be to create some tailormade reg-ex to split the voluminous text-file information into clusters I can load into a tailormade DB containing different tables making logical joins possible.
    ------
    My initial approach will be to instantiate an object representing the individual logging on to take the test.

    The object will contain, apart from the obvious, a private property array holding the answers given during the quiz session.

    The service is not an official test, meaning all objects will die at session end, including arrays held (this a dynamic option though. If i'd like to transfer the array info to a User table I can easily alter that later)

    The parent Class will contain the ODBC and neccessary SQL to complete the test. I'd also like to make an interface where 5 to 10 questions are listed on each page (depending on the verbosity of the question and accompanying answer choices), and where you have to fill in and commit the answer-radiobuttons, before you can optionally display/highlight the correct answers on each page, before continuing.

    All of the above coding is within the roam of my coding skills.
    (I'll probably list all the completed code here when I'm finished, for others to "enjoy".)

    My primary concern as for now, will be the DB. How do I structure the DB logically so as to make easy joins holding/presenting:
    1. Questions
    2. Answer options
    3. Correct answer matrix
    4. User specific info (to the extent that's required)


    The reason for a sensible table structure, is that questions are dynamic in nature. What was correct yesterday, may not be correct 6 months from now, even though the question remain unchanged. Some of the answer options might differ though.
    Likewise, the bulk of questions will primarily stay the same.
    However, there might be frequent alterations to the question bank, requiring "ON UPDATE/DELETE CASCADE" etc, to flush accompanying answer options when the "mother question" is deleted.
    --------
    I've already passed this question through private channels, so I'm expecting to recieve some suggestions beyond WDF. However, feel free to come forth with ideas (including coding suggestions if you feel up to it), as they will all be evaluated )
    S. Rosland

  2.  

  3. #2
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    The simplest I can think of is to store the questions and answers separatly. Potential and correct answers can be within the same table.

    Questions:
    questionid (primary)
    question

    Answers:
    answerid (primary)
    questionid
    answer
    iscorrect

    userspecific:
    userid
    questionid
    userspecificinfo


    May not be the most elegent but it will serve the purpose. As for coding suggestions, since you are taking OO approach, I won't be able to offer many. I have been and am doing most of my php work in procedural realm
    There and Back Again :Ogre:

  4. #3
    Member
    Join Date
    Dec 2004
    Posts
    67
    Member #
    8452
    Liked
    1 times
    Are you using mySQL? if so, phpMyAdmin has an import function. If you can convert it to xml you can add it in easily. If not, try (gasp!) Microsoft Access's import function. You can select how you formatted the text and it will import as best it can. Then you can use that in phpMyAdmin.
    Brian : This must be the physics department.
    Chris : That explains all the gravity.

  5. #4
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    Quote Originally Posted by Squeakypants
    Are you using mySQL? if so, phpMyAdmin has an import function. If you can convert it to xml you can add it in easily. If not, try (gasp!) Microsoft Access's import function.
    All of the above constitutes a table type layout ála Excel (tab or comma delimitation).

    If the source is purely textual, none of the above examples will work, as they are based on some sort of organization prior to export/import.

    But, don't worry, I've handled that mess before. If the textual representation holds any sort of system (as they most often do beeing visual representations), I can use the \n delimiter to peel apart the preceeding text-blocks to my desire, I basically split the information into logical chuncks through varying reg-ex techniques tailormade to the text at hand.

    The problem was more of normalization through table design. What do I include of columns in varying tables. Beeing dynamic (the root design of questions and answers), I need to make some easily maintainable structure in DB design.
    -----------

    Quote Originally Posted by nsr81
    The simplest I can think of is to store the questions and answers separatly. Potential and correct answers can be within the same table.

    May not be the most elegent but it will serve the purpose. As for coding suggestions, since you are taking OO approach, I won't be able to offer many. I have been and am doing most of my php work in procedural realm

    That looks pretty much the same as what I've come up with so far, with the exception of the private key in the questions bank. I'd like to keep the original question_number as the PK for the quiz table, for varying reasons.
    ----------
    <!--
    Irrelevant OO-stuff deleted. :squareeyed:
    -->
    S. Rosland

  6. #5
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    Oh boy, not another lecture LOL

    I thought you were already an OO master through your studies
    I am no master. I know the concepts and how to implements them in languages with good OO support, Java/C#/C++. But I have a C background and I have been using php since 4.1.x days. OO implementations weren't as elaborate as they are now. So I never really got into using OO with PHP. Why bother with an object/class when the same thing can be done with less code. I know that's not a good excuse to dismiss OO methodology, but I seems to have developed this bad habit as far as PHP goes.
    There and Back Again :Ogre:

  7. #6
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    Quote Originally Posted by nsr81
    Oh boy, not another lecture LOL
    I agree, that went totally off target :Ogre:

    (Post edited.)
    S. Rosland


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:26 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com