Re: Writing a Polling App - Need Some Advice
| From: | Kevin Stone | Date: | Thu, 21 Nov 2002 20:13:07 +0000 |
| Subject: | Re: Writing a Polling App - Need Some Advice | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125480@lists.php.net to get a copy of this message | ||
Somebody suggested downloading a pre-made script that does what you want but
I say that's no way to program. Simple scripts like this one clear the mind
and are good experience. Besides nobody ever got good at programming by
using pre-made scripts. ;-)
Okay down to basics. You can break up the problem into logical steps. The
way I would do this is have two tables. The first table stores the poll_ID,
name (or title), start_date, end_date. The second table stores poll_ID,
question, hits. If you need to prevent users from inputing more than one
answer you can store a third table containing, poll_ID, IP.
Your only redundency is the poll_ID value. This is your associating value
that binds the poll data together. In the first table this should be your
Primary Key and set it as an auto-incrementing unsigned integer. In the
second and third tables set it to integer and leave it alone. You might add
a separate auto-incrementing value to act as the primary key.
So hopefully this gets you started. If you need help with anything else let
me know.
-Kevin
----- Original Message -----
From: "Monty" <monty3@hotmail.com>
To: <php-general@lists.php.net>
Sent: Thursday, November 21, 2002 12:30 PM
Subject: [PHP] Writing a Polling App - Need Some Advice
> I'm writing a little polling app for a website, they want to run them each
> week. They will be the simple "choose your favorite" kind of
multiple-choice
> polls. If anyone has ever written one of these, what is the best way to
set
> up the poll questions? Do I store each question in a separate table and
link
> them to a central "Poll" record? Or do you store the questions all in one
> record? Or is there an even better way to do this?
>
> Any suggestions or pointers would be appreciated! Thanks.
>
> Monty
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>