<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

	class Mod_management extends CI_Model
	{
		var $table = "tbluser";
		function __construct()
		{
			parent::__construct();
		}	
		
		function getuser()
		{
			$id=$this->session->userdata('userId');
			$this->db->SELECT("*");
			$this->db->from("tbluser");
			$this->db->join("roles","roles.id = tbluser.role_id");	
			$this->db->where("userid !=",$id);	
			$this->db->order_by("userid"); 
			return $this->db->get();
			
			
		}
			
		function add($data)
		{
			$this->db->insert($this->table,$data);
			
		}


		function update($data,$id)
		{
			$this->db->where("userid",$id);
			$this->db->update($this->table,$data);
		}
		

		function delete($id)
		{
			$this->db->where("userid",$id);
			$this->db->delete($this->table);
		}
		
	
		function getById($id)
		{
			$this->db->where("userid",$id);
			$q = $this->db->get($this->table);
			if($q->num_rows() > 0)
			{
				return $q->row();
			}
			return false;
		}
		
			
		
		
	}