<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
/**
	 * 
	 */
 
	class Add_return_exchange_model extends CI_Model
	{
		 
		
		function __construct()
		{
			parent::__construct();
		}

	

		function db_insert()
		{

			$ds = $this->db->get('return_exchange');
			if($ds->num_rows() > 0){ 
					$alt = $this->input->post('text');
					
							$data =  array(
						'text' =>$alt
					);

					
					$q = $this->db->update('return_exchange', $data);
					if($q){
						return 1;
					}else{
						return 2;
					}

				
			}else{
				$alt = $this->input->post('text');
			
							$data =  array(
						'text' =>$alt
					);

					$q = $this->db->insert('return_exchange', $data);
					if($q){
						return 1;
					}else{
						return 2;
					}

			}

			
						}
			
					
				
			
		



// UPDATE PRODUCT FUNCTION 
		
					
				
			
		
// UPDATE PRODUCT FUNCTION 
// UPDATE PRODUCT FUNCTION 

		function get_all(){
			$q = $this->db->get('return_exchange');
			if($q->num_rows() > 0){
				// return $q->num_rows();
				return $q->result();
			}else{
				return 0;
			}
		}

		

			


	}	

?>