Jump to content

[SOLVED] creating a poll


c_shelswell

Recommended Posts

Hi i've a little problem I was wondering if anybody might have any ideas on.

 

I've been asked to create a poll/questionnaire on a page. They basically want to be able to input up to 15 questions which a user can then select one to vote on. This bit's pretty simple, I was just going to make a mysql table with 15 id's then the user can add a question for each id. The thing is he want's to be able to save the results of that poll and make a new one. I was thinking of saving the results either in a text file or adding the to a single cell in a database add some "=>" then if i want to display the results again i can just use "explode". I suppose the other option would be to create a new table for each poll but this seems like not a very good idea to me.

 

If anybody's got any ideas I'd be really glad to hear them.

 

Many thanks

Link to comment
Share on other sites

Hi, not sure if you specifically have to design this from scratch but you can find exactly what you're looking for at hotscripts. In my opinion, there's no point in re-inventing the wheel :D

 

If you absolutely must do it from scratch then I'd create a table with 15 Q's like you said, but I'd do it so that when the poll is either closed or expired, it outputs all the results to a .txt stored on the server and then resets the table for the next poll to run.

 

Hope this helps.

 

Shaun

Link to comment
Share on other sites

one table with poll's question

fields : Pollkey, question, active (true/false)

 

one table with answers.

fields: answerkey,  answer, counter, Pollkey (from the above)

 

the field counter in table answers is increased by one when somebody choose an answer

if the field active from table polls subject is true then users can still vote

 

you join the tables polls with answers via the key Pollkey and when you show a poll question the answers with the same pollkey are shown as well.

 

That is coming in my mind right now...

 

 

 

 

 

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.