I hope someone can 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 divide it by the no. of users who voted 5, so 15/3 = 5.
Another sample is like this:
total 5 users
3 rated it 5
2 rated it 4
so 3*5/5 = 3.0 - where 3 is the no. of votes * 5(rate) divided by 5 (no. of voters)
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.
*note:
I also don't know how to make table.sql for this.