2016-11-11 54 views
0

我已經集成了傑米Rumbelow我的模型從GitHub做用笨的活動記錄查詢 - https://github.com/jamierumbelow/codeigniter-base-model如何通過(不爲null)在MY_Model

SELECT * FROM `user` WHERE user_id =1 and phone_no is not null; 

,我想利用基於myModel這個MySQL查詢和我試過這個。

$data['user_details'] = $this->user_details_model->get_many_by(array('user_id' => $user_id, 'phone_no' =>NULL)); 

上面的一個工作正常,但我想做相反is not null。請幫助我。謝謝

回答

1

試試這個:

$data['user_details'] = $this->user_details_model->get_many_by(array('user_id' => $user_id, 'phone_no !=' =>NULL)); 

也許這也可以工作:

$data['user_details'] = $this->user_details_model->get_many_by(array('user_id' => $user_id, 'phone_no IS NOT' =>NULL)); 
1

試試這個,可能有助於

$data['user_details'] = $this->user_details_model->get_many_by(array('user_id' => $user_id, 'phone_no != ' =>NULL)); 

OR

$data['user_details'] = $this->user_details_model->get_many_by(array('user_id' => $user_id, 'phone_no != ' =>"")); 
相關問題