SHOW:
|
|
- or go back to the newest paste.
| 1 | public function all_polling() {
| |
| 2 | $this->db->select('*');
| |
| 3 | $this->db->from('micom_pools');
| |
| 4 | $this->db->limit(1); | |
| 5 | $this->db->where('status','published');
| |
| 6 | $this->db->order_by('id','desc');
| |
| 7 | $query = $this->db->get(); | |
| 8 | return $query->result_array(); | |
| 9 | } | |
| 10 | ||
| 11 | - | public function polling_sum($id){
|
| 11 | + | public function polling_sum($id==NULL){
|
| 12 | $this->db->select('count(*) as jml_vote ');
| |
| 13 | $this->db->from('micom_votes');
| |
| 14 | if($id!=NULL){
| |
| 15 | $this->db->where('pool_id',$id);
| |
| 16 | } | |
| 17 | $query = $this->db->get(); | |
| 18 | return $query->result_array(); | |
| 19 | ||
| 20 | } | |
| 21 | ||
| 22 | public function jum_vote($id,$answer){
| |
| 23 | $this->db->select('count(*) as jum');
| |
| 24 | $this->db->from('micom_votes');
| |
| 25 | $this->db->where(array('pool_id'=>$id,'answer_id'=>$answer));
| |
| 26 | $query = $this->db->get(); | |
| 27 | return $query->result_array(); | |
| 28 | } |