Codeigniter活动记录:大于语句 [英] Codeigniter Active record: greater than statement
本文介绍了Codeigniter活动记录:大于语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将大于 where语句转换为CI的Active Record语法。当我使用此代码段
I'm trying to convert a "greater than" where statement to CI's Active Record syntax. When I use this snippet
$this->db->join('product_stocks', "product_stocks.size_id_fk = product_attributes.id", "left");
$this->db->where('product_stocks.stock_level', '> 1');
$result = $this->db->get('product_attributes')->result_array();
然后打印$ this-> db-> last_query();显示 WHERE
product_stocks 。
stock_level =’> 1’
当然是不正确的。
Then print $this->db->last_query(); shows WHERE
product_stocks.
stock_level= '> 1'
which is of course not correct. Can this be done?
推荐答案
我认为这应该可以解决问题:
I think this should do the trick:
$this->db->where('product_stocks.stock_level >', '1'); //moved the >
这篇关于Codeigniter活动记录:大于语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文