<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of projectsetupmodel
 *
 * @author BusyMan
 */
class ProjectSetupModel extends CI_Model {
    //put your code here
    private $_tbl_PC = 'tbl_project';

    public function saveProjectcategory($data) {
        //print_r($data);die();
        $this->db->insert($this->_tbl_PC, $data);
        return $this->db->insert_id();
    }
    public function getCategoryInfo(){
    	$query=$this->db->get($this->_tbl_PC);
    	$result=$query->result_array();
    	if(!empty($result)){
    		return $result;
    	}
    }

    public function getprojectCategoryById($id)
    {
       $query=$this->db->get_where($this->_tbl_PC,array('project_id'=>$id));
        $result=$query->row_array();
        if(!empty($result)){
            return $result;
        } 
    }

    public function updateProjectcategory($data,$project_id)
    {
        $this->db->update($this->_tbl_PC,$data,array('project_id'=>$project_id));
        return $this->db->affected_rows();
    }

    public function deleteProjectcategory($project_id){
        $this->db->delete($this->_tbl_PC,array('project_id'=>$project_id));
        return $this->db->affected_rows();
    }
}
