-
-
Save KrotovRoman/5ca91f9f190f09bd8fd1fba49728a634 to your computer and use it in GitHub Desktop.
подсчитать за какой файл больше всего проголосовали
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function get_winner_opros($id_opros) { | |
| $this->db->limit(1); | |
| $this->db->select('id_file, count(*) as count'); | |
| $this->db->group_by('id_file'); | |
| $this->db->order_by('count', 'desc'); | |
| $this->db->where('id_opros', $id_opros); | |
| $files_votes = $this->db->get('files_votes'); | |
| if ($files_votes->num_rows() <= 0) { | |
| return FALSE; | |
| } | |
| return $files_votes->row()->id_file; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment