[thelist] Displaying survey results

matthew garrett matthew.garrett at snet.net
Mon Mar 19 21:13:02 CST 2001

Having had no experience...
If you are *not* tracking who voted for what, then you can just have one row
for each question, with question_number as the key, and with one field for
each answer. So each question_number would have fields a, b, c, d - and when
they submit, you increment the appropriate choice by one - probably using a
CFLOOP in there somewhere. To show results, you just select question_number,
a, b, c, d and order by question_number, and your done - hardly bogging down
at all.

If you need to keep track of who did what, then you might consider two
different tables, one as above, and one where each individual's selections
are tracked as you proposed. You can still do the simple query for the
totals, and a different query for individual info. That's probably some kind
of horrid database no-no, but my stomach hurts, and it's time for bed.

Hopefully the real database wizards are still awake...

good luck,

> From: Minh Lee Goon <v7ac at sdsumus.sdstate.edu>
> I've been asked to create a survey in ColdFusion and then display the
> results after the user has submitted his/her response. I was wondering
> how I could go about displaying the results in the most efficient
> manner.
> The survey has a series of questions with four choices for each
> question. The values for each option are a, b, d, and d, and the results
> are inserted into an Access database as such. So for the rows in the
> results table, each column will contain the value a, b, c, or d.
> Here's my question: How do I display that information so that it's
> understandable? It doesn't have to be graphical, just comprehensive. The
> crudest method would be to query each column in the results database for
> every possible option (i.e. four queries per question for each option,
> using the WHERE clause in my SELECT statement) and then displaying the
> results using RecordCount.

More information about the thelist mailing list