Computing.Net > Forums > Web Development > voting script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

voting script

Reply to Message Icon

Name: BigShow
Date: October 8, 2006 at 19:57:17 Pacific
OS: xp
CPU/Ram: pentium 4
Product: dell
Comment:

I have a question about creating a script that would allow someone to go to my website and vote on something. For example, if I had a survey on there for the best hitter of all time and gave 5 choices, i would want people to vote and I would want the results to show up in some sort of graph automatically and immediately, if possible. Would I have to make a small database? Any help would be appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: October 8, 2006 at 22:20:12 Pacific
Reply:

"Would I have to make a small database?"

Not necessarily. You could save the results in a text file. Just read the text file to display the results. When someone posts their vote, open the text file and change the appropriate results and save it back to the file.

However, doing this does have it's problems. If, for instance, two people submit their votes at very close to the same time you could end up corrupting the file.

Michael J


0

Response Number 2
Name: BigShow
Date: October 9, 2006 at 16:28:54 Pacific
Reply:

Michael let me revise the question as I figured exactly what i want, I want to give choices to vote on, i want someone to vote on then (example vote the best of 5 ) and have this compute automatically and every hour or so have it update the order of the choices, or maybe even update the order automatically. I dont want to go through emails tirelessly, i figure php and a database, if u agree have you seen any pre made scripts like this or close to it.


0

Response Number 3
Name: Michael J (by mjdamato)
Date: October 9, 2006 at 18:22:35 Pacific
Reply:

Again, the answer is yes. You can use a database or you could use a flat file. You can get as complex or as simple as you wish.

For example, if you had a vote for the best actors ever and you had 5 options, the txt file might contain the following (minus the lines):
-------------------
Mel Gibson: 25
Leroy Jenkins: 2
William Shatner: 0
Tom Hanks: 45
Donald Sutherland: 8
-------------------

When soeone makes a vote you have the PHP open the file and increment the value of the entry they selected by 1.

When displaying the results (or to order the vorting options) just have the PHP open the file and read the contents. Then display the results accordingly.

Michael J


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: voting script

Need a tell a friend script www.computing.net/answers/webdevel/need-a-tell-a-friend-script/1614.html

Disect action scripts into layers www.computing.net/answers/webdevel/disect-action-scripts-into-layers/2523.html

Dam PHP! www.computing.net/answers/webdevel/dam-php/752.html