View Single Post
Old 06-10-2002, 11:14 AM   #9 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,709
redhead is on a distinguished road
I'll give a hint on how it could be done..

MySQL part:
two tables, first one
Choice:
(id, name, Poll_id, count)
second one
Poll:
(id, name)
When creating a new poll, you creat a new choice item, for every choice it should hold. set the Poll_id to reflect the id of the Poll holding the name of the poll.

When displaying the poll, have a php/MySQL statement like:
$row_poll=SELECT * FROM Poll WHERE name = "poll name";
$row_choice=SELECT * FROM Choice WHERE Poll_id = row_poll[id];

When a user selects a choice, and submits you increment the count for that Choice, and sets a cookie holding the Poll id, on next return, if the user has a cookie of the same id, as Poll_id, display a graphical result of the choices having that Poll_id, else its a new user, so display a form with the choices for that poll.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote