<?php
class Status_model extends CI_Model {

    public function __construct()
    {
        $this->load->database();
    }
    
    public function get_status()
    {  
        $this->db->order_by ( 'status_id', "asc" );
        $query = $this->db->get('status');
         return $query->result ();
    }    


    
    public function get_status_name($_name){
        $query = $this->db->get_where('status', array('status_name' => $_name));
        return $query->row_array();
    }
    
    public function get_one_status($_id){
        $query = $this->db->get_where('status', array('status_id' => $_id));
        return $query->row_array();
    }
    
    public function update_status($_id,$_data){
        $this->db->where('status_id',$_id);
        $this->db->update("status",$_data);
        return $this->db->affected_rows();
    }
    public function add_status($_data){
        $this->db->insert("status",$_data);
        return $this->db->affected_rows();        
    }    
}

