c_shelswell Posted December 17, 2007 Share Posted December 17, 2007 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 Quote Link to comment Share on other sites More sharing options...
VirusDoctor Posted December 17, 2007 Share Posted December 17, 2007 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 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 Quote Link to comment Share on other sites More sharing options...
c_shelswell Posted December 17, 2007 Author Share Posted December 17, 2007 great cheers i'll take a look at that hotscripts one. It doesn't have to be from scratch at all so that might be easier. Cheers Quote Link to comment Share on other sites More sharing options...
snk Posted December 17, 2007 Share Posted December 17, 2007 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... Quote Link to comment Share on other sites More sharing options...
c_shelswell Posted December 17, 2007 Author Share Posted December 17, 2007 Then i presume down to a text file afterwards again so you can still display the results after a new poll is in place? Quote Link to comment Share on other sites More sharing options...
snk Posted December 17, 2007 Share Posted December 17, 2007 why to write it down to a flat file? keep it in sql. the field active helps to show a poll whenever you want, or to show just the results without the ability of voting Quote Link to comment Share on other sites More sharing options...
c_shelswell Posted December 17, 2007 Author Share Posted December 17, 2007 right i get it - yeah that's a really good idea. So a user can add a new poll really easily - brilliant thanks very much Quote Link to comment 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.