使用活动记录时如何忽略 codeigniter 中的反引号?我需要按案例订购 [英] how do i ignore the backticks in codeigniter when using active records? i need to order by cases
本文介绍了使用活动记录时如何忽略 codeigniter 中的反引号?我需要按案例订购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用活动记录时如何忽略 codeigniter 中的反引号?我需要按案例订购
case 当 roll_number 为空然后 1 else 0 结束,
哪个代码点火器使它成为
ORDER BY `case` 当 roll_number 为 null 然后 1 else 0 end
这给了我一个错误.请帮忙
解决方案
感谢您的回答...
我发现在使用 $this->db->order_by()
时,活动记录中不能跳过反引号.
所以最终使用了 $this->db->query($sql);
在那里我将我的普通 mysql 查询分配给了 $sql
变量>
how do i ignore the backticks in codeigniter when using active records? i need to order by cases
case when roll_number is null then 1 else 0 end,
which code igniter makes it as
ORDER BY `case` when roll_number is null then 1 else 0 end
which gives me an error. Please help
解决方案
Thanks for your answers...
I figured out that in active records when using $this->db->order_by()
you can't skip the backticks.
So ended up using $this->db->query($sql);
where I assigned my normal mysql query to the $sql
variable
这篇关于使用活动记录时如何忽略 codeigniter 中的反引号?我需要按案例订购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文