1

Codeigniter 不返回错误号

 $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 时,错误号有所不同。为什么我没有得到正确的错误号。有人可以指出问题。谢谢,

4

2 回答 2

0

I got the error number by echo $this->db->_error_number(); before the trans_complete(); Thanks all

于 2012-10-30T09:15:52.000 回答
0

对于其他遇到类似问题的人。确保您在 database.php 配置文件中启用了数据库调试。

于 2012-10-30T12:52:17.043 回答