Advertisement
banyucenter

m_user.php

Nov 3rd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. <?php
  2. class M_user extends CI_Model{
  3.   var $tabel = 'tb_user';
  4.   function tampil_data(){
  5.         return $this->db->get('tb_user');
  6.   }
  7.  
  8.   function get_user_byid($id) {
  9.     $this->db->from($this->tabel);
  10.     $this->db->where('id', $id);
  11.     $query = $this->db->get();
  12.         if ($query->num_rows() == 1) {
  13.             return $query->result();
  14.         }
  15.     }
  16.  
  17.    function input_user($data,$table){
  18.     $this->db->insert($table,$data);
  19.     }
  20.  
  21.    function edit_data($where,$table){
  22.         return $this->db->get_where($table,$where);
  23.      }
  24.    
  25.    function get_update($where,$data,$table){
  26.         $this->db->where($where);
  27.         $this->db->update($this->tabel, $data);
  28.         return TRUE;
  29.      }
  30.  
  31.    function hapus_data($where,$table){
  32.         $this->db->where($where);
  33.         $this->db->delete($table);
  34.       }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement