[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

PHP Mysql - Show poll results as percentage

Asked by Widescope in Microsoft Word, PHP Scripting Language, PHP and Databases

Tags: poll, percentage, %

Hello,

I have created a simple poll with 2 options (Yes and No).

Once the poll has been submitted it directs to a page showing the results, I have the total amounts for Yes and No displaying, but I need to show the results as a % of the total votes.

Currently displays
Yes = 3 votes
No = 1 votes

I need it to display
Yes = 75%
No = 25

The recordset's I am currently using, are in the below format.

SELECT answer,COUNT(answer)  As Total
FROM poll
WHERE poll.answer = 'Yes'
GROUP BY (answer)

Can anyone help. Thanks.
[+][-]11/06/09 03:40 AM, ID: 25758271Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625