<?php

class MUsers extends CI_Model{
    function addUser($input){
        $this->db->insert('tbl_users',$input);
    }
    function updateUser($input,$id){
        $this->db->where('user_id',$id);
        $this->db->update('tbl_users',$input);
    }
    function getUsers($id=''){
        if ($id!=''){
            $this->db->where('user_id',$id);
        }
        $this->db->where('status', 1);
        $this->db->or_where('status', 2);
        $result=$this->db->get('tbl_users');
        if ($id!=''){
            return $result->row();
        }
        return $result->result();
    }
    function getUserById($id){
        $this->db->where('user_id',$id);
        return $this->db->get('tbl_users')->row();
    }
    function deleteuser($id){
        $table="tbl_users";
        $this->db->where('user_id',$id);
        $input['status']=0;
        $this->db->update($table,$input);
    }
}