gpt4 book ai didi

php - 在 codeigniter 中通过查询转义订单

转载 作者:可可西里 更新时间:2023-11-01 07:17:56 25 4
gpt4 key购买 nike

这是运行的 SQL 查询:

SELECT * FROM (`news`) WHERE `country` IS NULL AND `region` IS NULL ORDER BY IFNULL(update_date, `create_date)` DESC

你可能会注意到 create_date 有一些格式错误,我想禁用转义,但即使我在 order_by 函数之后添加 false 它也没有效果。如何解决?非常感谢

 $this->db->select('*');
$this->db->from('news');
$this->db->where($data);
$this->db->order_by('IFNULL(update_date,create_date)', 'DESC', false);
$query = $this->db->get();
return $query->result_array();

最佳答案

使用下面的代码:

$this->db->_protect_identifiers = FALSE;

$this->db->order_by('IFNULL(update_date,create_date)', 'DESC', false);

$this->db->_protect_identifiers = TRUE;

关于php - 在 codeigniter 中通过查询转义订单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28491966/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com