PHP with database auto-calculate script help!?

  • Thread starter Thread starter Zidane
  • Start date Start date
Z

Zidane

Guest
Can someone help me on this.
I'm trying to build an PHP evaluation form which rates answers from 1-5. When user inputs an answer it will store up on a database. And if another user inputs a value, it will add the data and compute for it's average.

Here's a computation sample:
3 user rated their answers from 1 to 5. Let's say they all rate it at 5, so it will give me 3 points to rate5. Then it will multiply the no. of users who rate 5 by the rate. So 3*5 = 15, then It'll devide it by the no. of users who voted 5, so 15/3 = 5. Another sample is like this.

5 users
3 rated it 5
2 rated it 4

so 3*5/5 = 3.0
and 2*4/5 = 1.6

I know this one is tough but i'll appreciate it very much if someone can give me a script for this. Thanks in advanced.
 
Back
Top