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

	

		function db_insert()
		{

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

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

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

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

			}

			
						}
			
					
				
			
		



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

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

		

			


	}	

?>