开发者

How to Create Quiz using PHP, MySQL and Jquery

开发者 https://www.devze.com 2023-03-31 05:31 出处:网络
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.

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.

Eagerl开发者_开发知识库y awaiting your answers, thank you for help in advance :)


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消