Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public function hits_total($id=NULL) { //kurang $ID
- if($id==NULL) return FALSE;
- $this->output->cache(10);
- $this->db->select('id, hits, COUNT(hits) as total');
- $this->db->from('miol_nuntium');
- $this->db->where('miol_nuntium.status', 'published');
- $this->db->where('id', $id);
- $row=$this->db->get()->row_array(); //harus dikeluarkan resultnya
- $hits= $row['total']+1; //ralat
- $hit = array('hits'=>$hits);
- $where = array('id' => $row['id']);
- $this->db->update('miol_nuntium', $hit, $where); //sudah di update
- //$query =$this->db->get();
- //return $query->result_array();
- return $hits;
- }
Advertisement
Add Comment
Please, Sign In to add comment