thinkphp多条件查询如何写

WBOY
Release: 2016-06-13 12:07:59
Original
972 people have browsed it

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

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

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



Related labels:
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