We are doing a reader survey, and many of the questions involve multiple selection answers (in this case, we're using check boxes). So of course, answers are arrays, and are then stored in mysql after being serialized.
My problem is arising when trying to get the collected info out in a readable format. I would like to spit out each distinct value and then a count of how many readers checked it.
For example, with a single select question, I'm doing it this way with no problem:
PHP Code:
<? $resAge = mysql_query("select age, count(*) as numAge from survey2010 group by age");
while ($rowAge = mysql_fetch_array($resAge)){
extract($rowAge);
$perAge = round(($numAge / $respondants) *100, 0);
print('<tr><td class="surveyForm"> ' .$age .'</td><td class="surveyForm">' .$numAge .'</td><td class="surveyForm">' .$perAge .'% </td></tr>');
}
?>
I'm completely baffled on how to make this work with the above described situation in which each row from mysql is possibly an array itself. Suggestions would be very much appreciated. Thanks.
|