![]() |
Poll System - Difficulties with result page - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Poll System - Difficulties with result page (/showthread.php?tid=37035) |
Poll System - Difficulties with result page - El Forum - 12-24-2010 [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. |