<?php
class Area_model extends CI_Model {

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


    
    public function get_area_name($_name){
        $query = $this->db->get_where('area', array('area_name' => $_name));
        return $query->row_array();
    }
    
    public function get_one_area($_id){
        $query = $this->db->get_where('area', array('area_id' => $_id));
        return $query->row_array();
    }
    
    public function update_area($_id,$_data){
        $this->db->where('area_id',$_id);
        $this->db->update("area",$_data);
        return $this->db->affected_rows();
    }
    public function add_area($_data){
        $this->db->insert("area",$_data);
        return $this->db->affected_rows();        
    }    
}

