奋斗的蚂蚁 发表于 2014-5-7 12:38:58

$this->db->where('id',$id) 当where参数值$id是一个数组时,怎么查

现在有一个数组$id,里面有几个客户的id,我要根据这个数组里面的id分别查询出客户的name
$this->db->select('username');
$this->db->where('id',$id);
$query=$this->db->get('c_member');
return $query->result_array();

希望得到这些用户的用户名,麻烦各位大神帮帮忙



smilecc123 发表于 2014-5-7 15:00:22

这样写:
$this->db->select('username');
$this->db->where_in('id',$id);
$query=$this->db->get('c_member');
return $query->result_array();

奋斗的蚂蚁 发表于 2014-5-10 10:38:41

谢谢 试了 可以的 {:soso_e113:}
页: [1]
查看完整版本: $this->db->where('id',$id) 当where参数值$id是一个数组时,怎么查