<?php
class Insert_data extends CI_Model{
	
	function setslider(){
	   $data = array(
       's_title'  => $this->input->post('s_title'),
	   's_image'  => $this->input->post('s_image'),
	   's_content'  => $this->input->post('s_content')	    
       );
       $this->db->insert('slider', $data);
	   $id = mysql_insert_id();
	   $slider =$this->input->post('s_title');
	   move_uploaded_file($_FILES['s_image']['tmp_name'], 'assets/uploads/slider/'.$slider.'_'.$id.'.jpg');	   
	}
	
	function setproduct(){
    	$data = array(
   		'p_name'  => $this->input->post('p_name'),    
		'p_description'  => $this->input->post('p_description'),
		'p_status' => 'Enable'        
    	);
    	$this->db->insert('product', $data);
    }
	
	function setsubproduct($p_id){
    	$data = array(
   		'p_id'  => $p_id,
		'sp_name'  => $this->input->post('sp_name'),    
		'sp_description'  => $this->input->post('sp_description'),        
    	'sp_status' => 'Enable'
		);
    	$this->db->insert('sub_products', $data);
		$sp_id=mysql_insert_id();
		move_uploaded_file($_FILES['sp_image']['tmp_name'],'assets/uploads/sub_products/'.$sp_id.'.jpg');
    }

}
?>