|
Posted by BearItAll on 11/17/05 16:21
On Wed, 16 Nov 2005 09:00:29 -0500, DNC_TN wrote:
> I'm VERY new at php. I was wondering what method I could use to
> develop a poll system where people could vote on something and I could
> count the vote and display results. Also, make it so that only one
> vote per person would count [yes I know some could use proxies to vote
> more than once, but at least get 99% of duplicates out of the
> results].
>
> thanks
> ************************************
> http://www.dubyareport.net/
> New and Improved...No More Sillyness
The interest in coding comes from doing it yourself, true that viewing
other peoples can teach you a lot, but just 'using' someone elses code
will not teach you anything.
As Geoff said you can do various things to ensure one vote.
A polling system is a good basis for a programming exercise, because the
theory is very simple and they are many possible sollutions. Here is a
simple first thought to hopefully get you working out a better way.
If it is just a fun thing then just identifying the users from the normal
client information is enough.
If your using a database to hold questions & responses then a three table
system in these lines might be a nice way to do it.
Table 1 questions,
id,Questions
Table 2 responses,
id,questions_id,response
Table 3 votes
id,user(identified from IP & client information),question_id,response_id
That way your poll isn't limited to a set number of possible responses,
counting up the votes can be a very simple loop. plus you have an
automatic history of polls built in.
[Back to original message]
|