Home > Backend Development > PHP Tutorial > thinkphp筛选有关问题

thinkphp筛选有关问题

WBOY
Release: 2016-06-13 12:07:03
Original
1103 people have browsed it

thinkphp筛选问题


怎么根据这2个字段进行双晒选呢~~

------解决思路----------------------
$Model->where($condition)->select();
$condition和平常sql一样写就行了,可以写多个条件and连接
------解决思路----------------------
TP有自己封装好的函数进行操作,也可以使用SQL语句进行操作,看你需求,如果是很复杂的话自己写SQL运行,如果不是的话TP封装好的那些函数就完全足够了。不过像LZ这种只是两个条件进行查询的话采用楼上的方法完全足够了。
------解决思路----------------------
M('tablename')->where("Position = 'xxx' and Recruitment = 'xxx'")->select();
------解决思路----------------------

引用:
Quote: 引用:

$Model->where($condition)->select();
$condition和平常sql一样写就行了,可以写多个条件and连接



抱歉  完全不会写~~能否写的全一点呢????  新手~~

<br />$Model=M("tablename");//这里把tablename换成你的表名<br />$list=$Model->where("Position = 'xxx' and Recruitment = 'xxx'")->select(); //这里像平常写sql一样,把xxx内容换成你两个字段的条件要求<br />$this->assign("list",$list);//最后把查询的数组结果,传入模板中,在模板中循环调用就行了<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