Hi,
I am finishing up a small poll script, and I need a little help:
At the begining of the script I ask the admin how many answers they want with to poll question. They enter the # into a form field, and on the next page it dynamically generates the correct # of fields.
Now I'm working on the results page - I need a small code snippet that does the following:
1. Determines how many answers are in the poll (Using mysql_num_rows or COUNT($fieldname)
2. Generates the results and displays the poll question, as well as the percent/# of votes for each answer.
Seems like this can be done very easily - Maybe with a while loop or for statement? Let's get this done now :)
My Tables look like this:
CREATE TABLE master_poll (
id smallint not null primary key auto_increment,
question text,
status varchar(15),
startdate text
)
CREATE TABLE poll_answers (
id varchar(5),
poll_id varchar(5),
answer varchar(100)
)
CREATE TABLE poll_votes (
poll_id varchar(5),
answer_id varchar(5),
ipaddress varchar(25),
time text
)