|
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.
|