哪里不是“空”

时间:2013-11-20 19:26:05

标签: php mysql codeigniter

我正在尝试使用CI编写声明,但我在撰写WHERE is not = " "

时遇到了问题

我可以举一个例子吗到目前为止

$empty = array('');
$this->db->where_not_in("$this->_table['shop_shipping_rules']}.shop_shipping_rule_name", $empty);

3 个答案:

答案 0 :(得分:0)

使用简单的where()

尝试此操作
$this->db->where("$this->_table['shop_shipping_rules']}.shop_shipping_rule_name !='' OR 
$this->_table['shop_shipping_rules']}.shop_shipping_rule_name IS NOT NULL
");

修改

$this->db->select('*');
$this->db->from('mytable');
 $this->db->where("shop_shipping_rule_name IS NOT NULL AND shop_shipping_rule_name !=''")
$query = $this->db->get();

OR

$this->db->select('*');
$this->db->from('mytable');
 $this->db->where(" TRIM(shop_shipping_rule_name) IS NOT NULL AND TRIM(shop_shipping_rule_name) !=''")
$query = $this->db->get();

Active Record Class

Mysql TRIM()

答案 1 :(得分:0)

尝试这样的事情:

$this->db->where('field_name IS NOT NULL');

或者这样:

$this->db->where('field_name !=' , '');

答案 2 :(得分:0)

只需将""where

一起使用即可
$this->db->where("$this->_table['shop_shipping_rules']}.shop_shipping_rule_name !=", "");