[英]can I add array to where clause to update_batch in codeigniter
[英]how can i pass array in where clause with codeigniter?
如何使用Codeigniter在where子句中傳遞數組變量? 例如,使用以下SQL查詢:
Select(" item,price Where(userid=123 and proid=3 or userid=124 and proid=3... [upto n user id]userid=nth_id and proid=3");
如果userid存儲在數組變量中,那么如何在codeigniter中創建這樣的條件?
我正在尋找這個對象,它應該尋找數組中的userid
,並且其proid
為3。我尚未對其進行測試,但請告訴我們您的情況。
$array = array( '123', '124' );
$this->db
->select( 'item, price' )
->from( 'table')
->where( 'proid', '3' )
->where_in( 'userid', $array )
->get();
$result = $query->result();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.