传递数组到在codeigniter活动记录 [英] Pass array to where in Codeigniter Active Record
本文介绍了传递数组到在codeigniter活动记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表在我与adminId和客户端ID数据库
有可能是20条记录与登录用户的adminId,我试图拉客户的名单。
我想知道是否有一种方法,我可以这样说:
$这个 - > DB-化合物其中('身份证','20 || 15 || 22 || 46 || 86');
我试图用动态数据做到这一点(你永远不知道有多少客户编号的你需要拉)。任何想法?
解决方案
$这个 - > DB-> where_in('身份证',阵列('20','15' ,'22','42','86'));
参考: where_in
I have a table in my database with adminId and clientId
There might be 20 records with the adminId of the logged in user and I'm trying to pull a list of clients.
I am wondering if there is a way i can say something like:
$this->db->where('id', '20 || 15 || 22 || 46 || 86');
I'm trying to do this with dynamic data (you never know how many clients Id's you'll need to pull). Any ideas?
解决方案
$this->db->where_in('id', array('20','15','22','42','86'));
Reference: where_in
这篇关于传递数组到在codeigniter活动记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文