2013-11-20 69 views
0

我試圖用CI寫一個說法,但我有寫WHERE is not = " "如果不是「」空

我能有一個示例的問題,我至今都

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

回答

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()

+0

它仍然給我這樣的數據'[ 「shop_shipping_rule_name」] =>字符串(0) 「」' –

+1

@JessMcKenzie正是你需要的? –

+0

我有一個數據庫像http://d.pr/i/wCwu,我想只帶數據行 –

0

嘗試這樣的事:

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

或者這樣說:

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

它仍然通過數據通過 –

0

只需使用""where

$this->db->where("$this->_table['shop_shipping_rules']}.shop_shipping_rule_name !=", "");