Wrox Programmer Forums
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 20th, 2004, 05:22 AM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default mysql table

i have build a marketing survey page where it will answer a few questions. My problem is how am i going to build it.For example, i have 3 questions each with a few choices(radio buttons).
Question1 : How do you find the product?
        a. like it very much
        b. like it
        c. does not like it
        d. does not like it at all
Question2 : Will you buy the product?
        a. definitely will buy
        b. may be will buy
        c. may be not buy
        d. definitely will not buy
Question3 : How do you find the quality of the product?
        a. very good
        b. good
        c. bad
        d. very bad
Say, about 100 people answer the questions and my problem is how am i going to store it in the database so that i can retrieve it later? when retrieving data, i would like to know how many people answer the questions, how many people choose answer a,b,c and d respectively for each questions. How my mysql table should be?


 
Old February 20th, 2004, 04:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

One way is to create a table to store all the form answers, plus one column (optionally) to store the user ID of the person who submitted the form.

The data types of each column should be an enumerated type for all radio button inputs. The possible values for these types would match the possible answers for the question.


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
indexing MySQL table crmpicco MySQL 5 January 20th, 2006 06:00 AM
MySQL table names question cutesneakers PHP How-To 2 January 11th, 2005 12:35 AM
MySQL table types madhukp PHP Databases 1 December 16th, 2004 03:44 PM
mysql discount table hosefo81 PHP Databases 0 December 12th, 2003 10:58 PM
CREATE TABLE error in MySQL k4rm4killer PHP Databases 2 December 9th, 2003 01:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.