停止转义列名 codeigniter 活动记录
stop escaping column name codeigniter active record
我有以下 activerecord 代码来获取发票和付款金额。
$this->db->select('invoice.*,customer.custid,customer.cust_name,customer.cperson,customer.cust_email,customer.cust_mobile,customer.cust_address,sum(payment_received.amount) as paid_amount');
$this->db->join('customer','customer.custid=invoice.custid');
$this->db->join('payment_received','invoice.inid=payment_received.inid','left');
$this->db->where('@paid_amount IS NULL');
由于 codeigniter 转义列名称带有 '`' 此字符显示错误 "Unknown column '@paid_amount' in 'where clause'"
如何停止转义列名??
你看过用户指南了吗? get 和 where 方法都接受一个参数以防止 CI 转义数据。
https://ellislab.com/codeIgniter/user-guide/database/active_record.html
我有以下 activerecord 代码来获取发票和付款金额。
$this->db->select('invoice.*,customer.custid,customer.cust_name,customer.cperson,customer.cust_email,customer.cust_mobile,customer.cust_address,sum(payment_received.amount) as paid_amount');
$this->db->join('customer','customer.custid=invoice.custid');
$this->db->join('payment_received','invoice.inid=payment_received.inid','left');
$this->db->where('@paid_amount IS NULL');
由于 codeigniter 转义列名称带有 '`' 此字符显示错误 "Unknown column '@paid_amount' in 'where clause'"
如何停止转义列名??
你看过用户指南了吗? get 和 where 方法都接受一个参数以防止 CI 转义数据。
https://ellislab.com/codeIgniter/user-guide/database/active_record.html