select problem / or use for loop?<

liunx

Guest
thx for reading this :

problem:
i have got a table (tblanswers)
what is in there :

i got a fields:

Answer, ID_survey, ID_Questions, USer ID
Values -->(test, 1, 1, 1);
(test2, 1, 2, 1);
(test3, 1, 3, 1);
(test, 1, 1, 2);
....

you get it?
just when you answer the survey i write it in the database and several users can take the test, even several times. here i work with option buttons but if i would work with checkboxes in the field answer there would be : test/test1/helo u c? i write every value the checked with a "/"

when i click on 'vieuw results' i want to see the results of 1 specific survey (i give it with the url)

but now the problem is can i do a select distinct (answer), count(*) or something like that?

i would like to see:

answers: --> number --> (option: percentage)
test --> 2 --> x%
....

you get the point?

i use mysql 4 with innoDB
can i use count(*) or so?
or do i have to use a for loop?

and more importantly how do i write it?

thx for reading this large question
 
Back
Top