Server IP : 101.255.104.117 / Your IP : 101.255.104.117 Web Server : Apache/2.4.34 (Win32) OpenSSL/1.0.2o PHP/5.6.38 System : Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586 User : user ( 0) PHP Version : 5.6.38 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/xampp182/htdocs/repository/application/models/ |
Upload File : |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Users_model extends CI_Model { public $table = 'users'; public $id = 'id'; public $order = 'DESC'; function __construct() { parent::__construct(); } // get all function get_all() { //$this->db->order_by($this->id, $this->order); $this->db->order_by('level', 'DESC'); return $this->db->get($this->table)->result(); } // get data by id function get_by_id($id) { $this->db->where($this->id, $id); return $this->db->get($this->table)->row(); } // get total rows function total_rows($q = NULL) { $this->db->like('id', $q); $this->db->or_like('username', $q); $this->db->or_like('password', $q); $this->db->or_like('level', $q); $this->db->from($this->table); return $this->db->count_all_results(); } // get data with limit and search function get_limit_data($limit, $start = 0, $q = NULL) { $this->db->order_by($this->id, $this->order); $this->db->like('id', $q); $this->db->or_like('username', $q); $this->db->or_like('password', $q); $this->db->or_like('level', $q); $this->db->limit($limit, $start); return $this->db->get($this->table)->result(); } // insert data function insert($data) { $this->db->insert($this->table, $data); } // update data function update($id, $data) { $this->db->where($this->id, $id); $this->db->update($this->table, $data); } // delete data function delete($id) { $this->db->where($this->id, $id); $this->db->delete($this->table); } } /* End of file Users_model.php */ /* Location: ./application/models/Users_model.php */