So before it not error like this, but when I have been created two stored procedure in my database and call it in my model. It error another function in my model. It not error the function that I call procedure. It error another function that I write raw sql in model (Codelgniter).
My Error
My Model
public function CheckProductInsert($company_id,$purchase_or_id,$product_id,$supplier_id){
$company_id = $this->db->escape_str($company_id);
$purchase_or_id = $this->db->escape_str($purchase_or_id);
$product_id = $this->db->escape_str($product_id);
$supplier_id = $this->db->escape_str($supplier_id);
$k="SELECT id
FROM gacc_purchases_or_details
WHERE
purchase_or_id=$purchase_or_id
AND product_id=$product_id
AND supplier_id=$supplier_id
AND company_id=$company_id
AND activate=1";
$re = $this->db->query($k);
if($re->num_rows() > 0){
return true;
}else{
return false;
}
}
My Controller
if($this->PurchaseOrders->CheckProductInsert(
$this->security->xss_clean($this->company_id),
$this->security->xss_clean($purchase_order_id),
$this->security->xss_clean($product_id),
$this->security->xss_clean($supplier_id)
)==false){
echo json_encode(
array(
'status'=>false,
'message'=>'good job'
)
);
}else{
if($lang=='EN'){
echo json_encode(
array(
'status'=>false,
'message'=>'This product you have been add already.'
)
);
}else{
echo json_encode(
array(
'status'=>false,
'message'=>'ផលិតផល ដែលលោកអ្នករក្សាទុក បានបញ្ចូលរួចហើយ'
)
);
}
}