SHARE
TWEET

Untitled

a guest Jun 20th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. defined('BASEPATH') or exit('No direct script access allowed');
  3.  
  4. class Admin_model extends CI_Model
  5. {
  6.     public function getAllData($table)
  7.     {
  8.         return $this->db->get($table);
  9.     }
  10.  
  11.     public function getData($table, $where)
  12.     {
  13.         return $this->db->get_where($table, $where);
  14.     }
  15.  
  16.     public function insertData($table, $data)
  17.     {
  18.         $this->db->insert($table, $data);
  19.     }
  20.  
  21.     public function updateData($table, $data, $where)
  22.     {
  23.         $this->db->update($table, $data, $where);
  24.     }
  25.  
  26.     public function update($table, $data)
  27.     {
  28.         $this->db->set();
  29.         $this->db->where('id', 2);
  30.         $this->db->update('mytable');
  31.     }
  32.  
  33.     public function deleteData($where, $table)
  34.     {
  35.         $this->db->where($where);
  36.         $this->db->delete($table);
  37.     }
  38.  
  39.     public function joinData($table1, $table2, $cond)
  40.     {
  41.         $this->db->select('*')
  42.             ->from($table1)
  43.             ->join($table2, $cond);
  44.         return $this->db->get();
  45.     }
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top