thinkphp多条件查询怎么写

WBOY
Release: 2016-06-23 13:47:35
Original
1205 people have browsed it

thinkphp多条件查询怎么写?
比如表user,字段id,name,nickname。现在根据name和adress多条件查询,$name和$nickname,两个条件是或,不是并。怎么写?
另外,如果查询条件为数组的话怎么写?比如$id=array(1,2,3),查找id为1,2,3的三条数据


回复讨论(解决方案)

1:

$a=M('user);$b=$a->where("name='你的名字' or nickname='你的昵称'")->select();
Copy after login

2:
$a=M('user'); $data['id']=array('in',array(1,2,3));             $b=$a->where($data)->select();  
Copy after login



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template