thinkphp如何按条件查询同表中的多条数据!
$new = M('wujiang');$data['id'] = 1;
$news = $new->where($data)->select();
我现在只会这样的普通查询,但是我现在想查询 ‘wujiang’表中id分别为 3,6,7,12,34,的数据,我怎么能把这些id字段下的数据同时查出来呢?
答案如下
$data['id'] = array('IN',array(3,6,7,12,34));
$news=$new->where($data)->select();
相当于 select * from wujiang where id in(3,6,7,12,34)
页:
[1]