3raser Posted March 8, 2012 Share Posted March 8, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/258502-making-a-poll-system/ Share on other sites More sharing options...
marcus Posted March 8, 2012 Share Posted March 8, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/258502-making-a-poll-system/#findComment-1325065 Share on other sites More sharing options...
3raser Posted March 8, 2012 Author Share Posted March 8, 2012 That's what I thought; I didn't know if it was the best way. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/258502-making-a-poll-system/#findComment-1325066 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.