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

class StateModel extends CI_Model{

	function __construct(){
		parent::__construct();
	}




		function selectFrontStfCatInfo($staff_catagory, $where){

			if($where){
			$this->db->where($where);
		}


				$sql ="SELECT 	id,NAME,STATUS FROM staff_catagory WHERE STATUS='active';";

			$query = $this->db->query($sql);

		if($query){

		//	print_r($query->result()); die;

		return $query->result();

		}else{
			return false;
		}

		}


		function selectCatInfo($type, $where){

    	if($where){
			$this->db->where($where);
		}

 	$query = $this->db->get($type);

		if($query){
			return $query->result();
		}else{
			return false;
		}
	}


    function selectInfo(){
      $sql ="SELECT id,NAME,STATUS FROM state_tb ;";
      $query = $this->db->query($sql);

		if($query){

	//	print_r($query->result()); die;

		return $query->result();

		}else{
			return false;
		}
	}

	function selectFrontInfo(){


			$sql ="SELECT id,NAME,STATUS FROM state_tb where STATUS='active' ;";

		$query = $this->db->query($sql);

	if($query){

//	print_r($query->result()); die;

	return $query->result();

	}else{
		return false;
	}

}

          // insert Query For Insert Data

	public function insertInfo($table, $data) {
		if ($this->db->insert($table, $data)) {
            $insert_id = $this->db->insert_id();
			return $insert_id;
		}else{
			return false;
		}
	}



    	function getInfoById($id){

    	 $sql ='SELECT 	id,NAME,STATUS FROM area_tb  WHERE id ="'.$id.'" ';


      $query = $this->db->query($sql);


     //	print_r($query->result()); die;

          $result = $query->result();
    return $result;
}



// Update Query For Selected Student
function updateInfoById($id,$data){
$this->db->where('id', $id);
$this->db->update('state_tb', $data);
}





function deleteInfo($id)
{

 $sql ='DELETE FROM state_tb WHERE id= "'.$id.'"; ';
  //print_r(base_url("GalleryImages/".$id.".png")); die;
	 //unlink(base_url("GalleryImages/".$id));

$this->db->query($sql);
}


}




?>
