gundambison

perbaikan 46

Apr 30th, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. public function hits_total($id=NULL) { //kurang $ID
  5.     if($id==NULL) return FALSE;
  6.     $this->output->cache(10);
  7.     $this->db->select('id, hits, COUNT(hits) as total');
  8.     $this->db->from('miol_nuntium');
  9.     $this->db->where('miol_nuntium.status', 'published');
  10.     $this->db->where('id', $id);
  11.     $row=$this->db->get()->row_array(); //harus dikeluarkan resultnya
  12.     $hits= $row['total']+1; //ralat
  13.     $hit = array('hits'=>$hits);
  14.     $where = array('id' => $row['id']);
  15.     $this->db->update('miol_nuntium', $hit, $where); //sudah di update
  16.     //$query =$this->db->get();
  17.     //return $query->result_array();
  18.     return $hits;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment