停止转义列名codeigniter活动记录

时间:2015-02-18 09:14:51

标签: php codeigniter

我有以下的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转义列名称带有'`'这个字母显示错误"未知列' @ paid_amount'在' where子句'"

如何停止转义列名?

1 个答案:

答案 0 :(得分:0)

你看过用户指南了吗? get和where方法都接受一个参数来阻止CI转义数据。

https://ellislab.com/codeIgniter/user-guide/database/active_record.html