停止转义列名codeigniter活动记录 [英] stop escaping column name codeigniter active record
本文介绍了停止转义列名codeigniter活动记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下activerecord代码来获取发票及其付款总额。
I have following activerecord code to get invoice and sum of its payment.
$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 'in'where子句'
Because of codeigniter escape column name with '`' this char its showing error "Unknown column '@paid_amount' in 'where clause'"
如何停止转义列名??
How to stop escaping of column name ??
推荐答案
您是否已阅读《用户指南》? get和where方法都接受一个参数,以防止CI逸出数据。
Have you looked at the User Guide? Both the get and where methods accept a parameter to prevent CI from escaping the data.
https://ellislab.com/codeIgniter/user-guide/database/active_record.html
这篇关于停止转义列名codeigniter活动记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文