BACKD00R 1337
Server IP : 164.52.202.56  /  Your IP : 216.73.216.208
Web Server : Apache
System : Linux e2e-70-56.ssdcloudindia.net 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64
User : rubyaromatics ( 1052)
PHP Version : 7.2.34
Directory (0755) :  /home/rubyaromatics/public_html/crm/application/models/

[  Home  ][  Terminal  ][  Upload File  ]

Current File : /home/rubyaromatics/public_html/crm/application/models/Discount_model.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Discount_model extends CI_Model
{
	function __construct() {
		parent::__construct();
		
	}
	public function index(){
		
	} 
	/* 
		return all discount details to display list  
	*/
	public function getDiscount(){
		$this->db->select('d.*,u.*')
				 ->from('discount d')
				 ->join('users u','u.id = d.user_id');
		return $this->db->get()->result();
	}
	/* 
		insert new  discount record in database 
	*/
	public function addModel($data){
		$sql = "insert into discount (discount_name,discount_value,user_id) values(?,?,?)";
		if($this->db->query($sql,$data)){
		/*if($this->db->insert('discount',$data)){*/
			return  $this->db->insert_id();
		}
		else{
			return FALSE;
		}
	}
	/* 
		return specific discount record to edit 
	*/
	public function getRecord($id){
		$sql = "select * from discount where discount_id = ?";
		if($query = $this->db->query($sql,array($id))){
		/*$this->db->where('discount_id',$data);
		if($query = $this->db->get('discount')){*/
			return $query->result();
		}
		else{
			return FALSE;
		}
	}
	/* 
		save edited discount record in databse 
	*/
	public function editModel($data,$id){
		$sql = "update discount set discount_name = ?,discount_value = ? where discount_id = ?";
		if($this->db->query($sql,array($data['discount_name'],$data['discount_value'],$id))){
		/*$this->db->where('discount_id',$id);
		if($this->db->update('discount',$data)){*/
			return TRUE;
		}
		else{
			return FALSE;
		}
	}
	/* 
		delete discount record from databse 
	*/
	public function deleteModel($id){
		$sql = "delete from discount where discount_id = ?";
		if($this->db->query($sql,array($id))){
		/*$this->db->where('discount_id',$id);
		if($this->db->delete('discount')){*/
			return TRUE;
		}
		else{
			return FALSE;
		}
	}
}
?>

security is just an illusion