<?php
class User_model extends CI_model
{

 function get_user()
  {
    $this->db->from('tbl_usermaster');
    return $this->db->get()->result_array();
  }


  public function check_user($user_name)
  {
    $this->db->select('*');
    $this->db->from('tbl_usermaster');
    $this->db->where('user_name',$user_name);
    $query=$this->db->get();

    if($query->num_rows()>0)
    {
    return false;
    }
    else
       {
        return true;
       }
          
  }
  
   //create user

  function add_user($user)
  {
    $this->db->insert('tbl_usermaster',$user); 
    return true;
  }

  //end create user

  //update user

  function update_user($user,$user_id)
  {
    $this->db->where('user_id',$user_id);
    $this->db->update('tbl_usermaster',$user);
    return true;
  }

  //end update user

  //return users

  function return_user($user_id)
  {
    $this->db->from('tbl_usermaster');
    $this->db->where('user_id',$user_id);
    return $this->db->get()->row();
  }

    //end users classes

    //update Status

    function update_status($status,$user_id)
    {
    $this->db->where('user_id',$user_id );
    $this->db->set('user_status',$status);
    $this->db->update('tbl_usermaster');
    }

   //end update Status

   //delete user

  function delete_user($user_id)
  {
    $this->db->where('user_id',$user_id);
    $this->db->delete('tbl_usermaster');
    return true;
  }

  //end delete classes
  
}


?>
