Jump to content

Making a poll system


3raser

Recommended Posts

What would be the most efficient way of letting my administrators make a poll? I want them to be able to set how many options (all options will be a radiobutton) they wish to have in the poll. I'm basically stuck on the part of: how would I store the poll options. Would I make separate table then store all the questions in there with the ID of the poll they created?

Link to comment
Share on other sites

You could have one table called "polls" that store id|question|administrator, and another table called "poll_answers" that store id|poll_id|answer, and another called "poll_results" that store id|answer_id|user_id

 

Test case:

 

-Administrator (UID 2) makes a new poll with the question "What is your favorite web browser?"

-"polls" has a new entry of 1|What is your favorite web browser?|2

-Administrator decides he wants 4 options, "Firefox", "Chrome", "Opera", "IE"

-"poll_answers" has four new entries:

1|1|Firefox

2|1|Chrome

3|1|Opera

4|1|IE

-User (UID 99) selects "Chrome" as his favorite browser

-"poll_results" has one new entry 1|2|99

Link to comment
Share on other sites

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.