Advertisement
sanca

contoh ambil jumlah

May 19th, 2019
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. //contoh pertama
  2. public function jumlahUser(){
  3.         return $this->db
  4.                 ->select('count(distinct(idUser)) as user')
  5.                 ->group_by('idUser')
  6.                 ->get('tableNya')->row()->user;
  7.     }
  8.  
  9. //contoh kedua
  10. public function jumlahUser(){
  11.         return $this->db
  12.                 ->select('count(idUser) as user')
  13.                 ->group_by('idUser')
  14.                 ->get('tableNya')->row()->user;
  15.     }
  16.  
  17.  
  18. //view nya saya gunakan ini:
  19. $totalUser=$this->modelnya->jumlahUSer();
  20.  
  21. echo $totalUser;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement