1
笨不返回錯誤號
$this->db->trans_start();
$deal_enquiry = $this->db->insert('deal_enquiry', $data);
$enquiry_id = $this->db->insert_id();
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
echo $this->db->_error_number();
if ($this->db->_error_number() == 0){
$errormsg="Duplicate entry";
return $errormsg;
} else{
$errormsg="Enquiry failed";
return $errormsg;
}
// return false;
} else {
return true;
}
錯誤號總是返回0,即使有錯誤。當我將db_debug設置爲true時,錯誤號是不同的。爲什麼我沒有得到正確的錯誤號碼。有人可以指出這個問題。 謝謝,
按照慣例,enything前綴_是一個私有成員。所以,你調用可能不會有一個默認的實現或超越私人/保護方法。總之,找到另一種方法,並嘗試只使用公共成員。 – MikeSW