Welcome Guest, Not a member yet? Register   Sign In
Poll System - Difficulties with result page
#1

[eluser]Unknown[/eluser]
I am currently developing a poll system where users have the ability to vote for other users on certain questions. (i.e: Who should win the next competition?)

The voting process itself works quite well so far. But now I want to create a results page where the votes are counted and the users with the most votes on certain questions are listed.

My votes table has the following columns: id, question_id, voter_id (the user who voted), receiver_id (the user who received the vote)

Now I am looking for a good way to order the users in the context of every question.
So I want to go through every question_id and check which receiver_id has got the most rows in the context of this question.

Does anyone have an idea what my model function/query should look like? By the way, it would be best if I received the first three users with the most votes for each question.




Theme © iAndrew 2016 - Forum software by © MyBB