Jump to content

Recommended Posts

i have a admin page where the admin submits the questions, options for answers, and the correct answer into a form. the data will then be recorded into a table in mysql called quiz.

 

there will be another page where the latest questions submited by the admin will be displayed for the participants to answer. the participants will then submit their answers in the forms. those who answer correctly, their information will go into the quiz_correct_response table. those who get wrong will go into the quiz_incorrect_response.

 

then, there will be a function to random out the winner. right now, all of the correct and incorrect responses are recorded into the 2 tables only. i need to random out the winners for different questions.

 

how should i go about doing it? should i have the code to create new tables for the questions everytime the admin submits a new one? i need a simple and organise way of doing this. please help me!

 

thanks in advance. hope u can understand this. ask questions if you need to clarify somethings.

Link to comment
https://forums.phpfreaks.com/topic/165351-help-for-php-pop-quiz/
Share on other sites

correct me if I'm wrong,

you want to select a random winner from the quiz_correct_response table?

yes. but since the questions are constantly being updated, i need to random pick a winner for every single questions.

 

take it like a lucky draw, you take part in a lucky draw and then the winner is randomly picked out. then the admin submits new questions for a new lucky draw, and another winner is randomly picked out. right now, the correct responses for all the lucky draws are in one single table, which makes it hard to random out the winner for the different lucky draws.

correct me if I'm wrong,

you want to select a random winner from the quiz_correct_response table?

yes. but since the questions are constantly being updated, i need to random pick a winner for every single questions.

 

take it like a lucky draw, you take part in a lucky draw and then the winner is randomly picked out. then the admin submits new questions for a new lucky draw, and another winner is randomly picked out. right now, the correct responses for all the lucky draws are in one single table, which makes it hard to random out the winner for the different lucky draws.

 

So you want to pick a winner for each quiz:

SELECT * FROM quiz_correct_response WHERE quiz_id = $id ORDER BY rand() LIMIT 1

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.