Re: hot to get percentages from text values?
| From: | David Robley | Date: | Tue, 12 Sep 2000 02:03:51 +0000 |
| Subject: | Re: hot to get percentages from text values? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-16269@lists.php.net to get a copy of this message | ||
On Tue, 12 Sep 2000, Sandeep Hundal wrote:
> Hi all,
>
> I'm developing a fairly large survey online, and haven't
> found any applications which I could use (can anyone help
> me on this?).
>
> Now its not that hard for me to input stuff into a database
> using php and mysql, but the problem will be extracting the
> info.
> One of the things I need to do is get percentage values of
> total answers which are text based answers.
>
> Eg. - x% of people had sex before they were 16.
> x% of people lost their virginity between the age of 17-19
> etc. etc...
>
> any help??
>
> thanks in advance!
>
> /sunny
If the answers are within a defined range (like YES or NO) you can use the
SQL COUNT to return the number of records for a given field value, and do
some simple manipulation of the value returned to get your percentages.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA