<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class ProductModel extends CI_Model{
public function exist_image($product_id) {
$this->db->select("picture");
$this->db->where('product_id',$product_id);
$query = $this->db->get('product');
return $query->row();
}
public function singleProduct($product_id){
$this->db->select("*");
$this->db->where('product_id',$product_id);
$query = $this->db->get('product');
return $query->row();
}
public function getUnselectID($product_id){
$this->db->select("*");
$this->db->where_not_in('product_id',$product_id);
$query = $this->db->get('product');
return $query->result_array();
}
public function exist_url($url, $id = null)
{
$this->db->where('Trim(LOWER(url))', $url);
if ($id != null) {
$this->db->where_not_in('product_id', $id);
}
$query = $this->db->get('product');
$rs = $query->num_rows();
if ($rs > 0) {
return false;
} else {
return true;
}
}
}
|