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
https://forums.phpfreaks.com/topic/258502-making-a-poll-system/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.