2

I need to create a quiz/multiple choice questions with correct answer.

Its basically for vocabulary, so 'A definition will be shown' and then possible Words would be provided.

My previous plan: Select word and meaning from Database, then generate the form for answers and then when user answers move on to next word.

I would be selecting words from database randomly, to keep it different each time. Also, I would be noting down how many times the word was answered correctly or incorrectly. So, that later on I can arrange them according to difficulty also.

My Problem: How do I update to the next question when user answers the question? How do I move on to the next problem, I thought I could do it easily using Jquery but integrating Jquery with PHP is tougher than it seems. I searched for plugins but they basically hard code the question in the JS, I wish to take them out from Database which would be updated as required.

Its a pet project, just so that I can help people practice their Vocabulary. I have implemented the basic design and also developed space for people to Contribute their words. The plans for expansion are vast with many possible directions, later, ranking system, facebook integration, etc. etc. I wish to finish it by the end of this weekend, so that I can move on to other things.

You can see vocabulary.dharamveer.in but you would only get idea about the basic application, not much regarding the problem at hand.

Eagerly awaiting your answers, thank you for help in advance :)

1
  • Why you don't look for some open source solution and analyse how it's made? Commented Aug 26, 2011 at 17:41

2 Answers 2

3

ajax is definitely the way to go with this, use ajax with json to load up your questions and then just have jquery loop through them.

Option 1

If you are creating a set length quiz, you could always create the full quiz off the start. That way you can ensure there are no repeating questions without the need to save anything. Then you can just loop through the whole quiz without making a call for each question.

Option 2

If it's a never ending quiz, then maybe you can do the questions in batches. Then when the user is done the old batch you can send that one back as a parameter and exclude them from the new batch. If your batches are large (for example 50 questions), than it would be at the very least 50 questions until a repeat and that's the worst case. Depending on how many questions you have total, you could end up with multiple batches before a repeat.

Sign up to request clarification or add additional context in comments.

Comments

2

I would use Ajax to he the next question. Have another page simply retrieve a single random question and retrieve it with jquery Ajax.

5 Comments

alright, but is there a way so that I don't pick up the word which has already been picked for obvious reasons, without going into details of each ID of words already picked and passing them to the file each time before retrieving the next question
You could use a second table to keep track on which user got what question and filter by that. If no one helps you by tomorrow, comment here again (I'm on mobile)
I'm building an ajax database-driven quiz with PHP and MySQL and I was wondering, how can I filter out questions that have already been answered? Once you answer a question I put a row in a table but I can't figure out how to filter out questions that have been answered when retrieving a question to display. Could you help? Thanks in advance :)
First., this should go on a separate question. Second, all you need to do is use a WHERE clause to filter out rows which has been answered.
I don't think it's as simple as that... remember, the ones that have been answered for a user are in a separate table. I'll post a question. Just thought maybe you could help since you said to the other person "You could use a second table to keep track on which user got what question and filter by that" so I thought maybe you would know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.