怎么根据这2个字段进行双晒选呢~~
回复讨论(解决方案)
做个沙发 静等高手哥哥的回答~~
$Model->where($condition)->select();
$condition和平常sql一样写就行了,可以写多个条件and连接
TP有自己封装好的函数进行操作,也可以使用SQL语句进行操作,看你需求,如果是很复杂的话自己写SQL运行,如果不是的话TP封装好的那些函数就完全足够了。不过像LZ这种只是两个条件进行查询的话采用楼上的方法完全足够了。
M('tablename')->where("Position = 'xxx' and Recruitment = 'xxx'")->select();
$Model->where($condition)->select();
$condition和平常sql一样写就行了,可以写多个条件and连接
抱歉 完全不会写~~能否写的全一点呢???? 新手~~
TP有自己封装好的函数进行操作,也可以使用SQL语句进行操作,看你需求,如果是很复杂的话自己写SQL运行,如果不是的话TP封装好的那些函数就完全足够了。不过像LZ这种只是两个条件进行查询的话采用楼上的方法完全足够了。
抱歉 完全不会写~~能否写的全一点呢???? 新手~~
TP有自己封装好的函数进行操作,也可以使用SQL语句进行操作,看你需求,如果是很复杂的话自己写SQL运行,如果不是的话TP封装好的那些函数就完全足够了。不过像LZ这种只是两个条件进行查询的话采用楼上的方法完全足够了。
抱歉 完全不会写~~能否写的全一点呢???? 新手~~
$Model->where($condition)->select();
$condition和平常sql一样写就行了,可以写多个条件and连接
抱歉 完全不会写~~能否写的全一点呢???? 新手~~
$Model=M("tablename");//这里把tablename换成你的表名$list=$Model->where("Position = 'xxx' and Recruitment = 'xxx'")->select(); //这里像平常写sql一样,把xxx内容换成你两个字段的条件要求$this->assign("list",$list);//最后把查询的数组结果,传入模板中,在模板中循环调用就行了
$Model->where($condition)->select();
$condition和平常sql一样写就行了,可以写多个条件and连接
抱歉 完全不会写~~能否写的全一点呢???? 新手~~
$Model=M("tablename");//这里把tablename换成你的表名$list=$Model->where("Position = 'xxx' and Recruitment = 'xxx'")->select(); //这里像平常写sql一样,把xxx内容换成你两个字段的条件要求$this->assign("list",$list);//最后把查询的数组结果,传入模板中,在模板中循环调用就行了
我就是没有搞懂 那个XXX是怎么传值的
是 第一个筛选还是其他的?
$Model->where($condition)->select();
$condition和平常sql一样写就行了,可以写多个条件and连接
抱歉 完全不会写~~能否写的全一点呢???? 新手~~
$Model=M("tablename");//这里把tablename换成你的表名$list=$Model->where("Position = 'xxx' and Recruitment = 'xxx'")->select(); //这里像平常写sql一样,把xxx内容换成你两个字段的条件要求$this->assign("list",$list);//最后把查询的数组结果,传入模板中,在模板中循环调用就行了
我就是没有搞懂 那个XXX是怎么传值的
是 第一个筛选还是其他的?
public function shaixuan(){
$data=M('zhaopin');
$aid=$_GET['id'];
$lists = $Data->where("Position = '$aid' and Recruitment = '$aid'")->select();
$this->assign('lists',$lists);
$this->display('index');
}
$Model->where($condition)->select();
$condition和平常sql一样写就行了,可以写多个条件and连接
抱歉 完全不会写~~能否写的全一点呢???? 新手~~
$Model=M("tablename");//这里把tablename换成你的表名$list=$Model->where("Position = 'xxx' and Recruitment = 'xxx'")->select(); //这里像平常写sql一样,把xxx内容换成你两个字段的条件要求$this->assign("list",$list);//最后把查询的数组结果,传入模板中,在模板中循环调用就行了
我就是没有搞懂 那个XXX是怎么传值的
是 第一个筛选还是其他的?
public function shaixuan(){$data=M('zhaopin');$aid=$_GET['id'];$lists = $Data->where("Position = '$aid' and Recruitment = '$aid'")->select();$this->assign('lists',$lists);$this->display('index');}<volist name="lists" id="vo"> <a href="/index.php/Zhaopin/shaixuan/id/{$vo[id]}">{$vo['Position']}</a> </volist>
汗,这个xxx没有规定怎么传啊,这个是条件,条件就是你想通过它来限制得到你想要的结果,那我问你,你为什么需要这两个字段来并列筛选呢,为什么不是所有字段都筛选呢!同理,比如你想筛选Position是111的记录,那就是$Data->where("Position = '111'")->select();至于这个111如果是动态传过来的,就像你写的,先获取,再组装到sql
你看你的项目如果你是直接M或者是D函数啥的就直接将页面传递过来的数据(包含GET、POST等一些列传参),然后填充到where中,如果你是按照表建立的单独的model类那你需要在public的方法中增加参数传入,如下:
/** * @todo get one news info */ public function getOneNewsInfo($id){ $where = '`id` = \''.$id.'\''; return $this->where($where)->select(); }
否则,就直接在页面调用:
$model = M('table'); $where = '`id` = \''.$id.'\''; $model ->where($where)->select();
你看你的项目如果你是直接M或者是D函数啥的就直接将页面传递过来的数据(包含GET、POST等一些列传参),然后填充到where中,如果你是按照表建立的单独的model类那你需要在public的方法中增加参数传入,如下:
/** * @todo get one news info */ public function getOneNewsInfo($id){ $where = '`id` = \''.$id.'\''; return $this->where($where)->select(); }
否则,就直接在页面调用:
$model = M('table'); $where = '`id` = \''.$id.'\''; $model ->where($where)->select();
恩 的确是获取到ID了 问题是 下面的内容不变化啊
public function index(){ $Data = M('zhaopin'); // 实例化Data数据对象 import('ORG.Util.Page');// 导入分页类 $count= $Data->where($map)->count();// 查询满足要求的总记录数 $Page= new Page($count,20);// 实例化分页类 传入总记录数 $nowPage = isset($_GET['p'])?$_GET['p']:1; $adi=$_GET['id']; $list = $Data->where($map,"Position = '$aid' and Recruitment = '$aid'")->order('shijian desc,id asc')->page($nowPage.','.$Page->listRows)->select(); $show = $Page->show();// 分页显示输出 $this->assign('page',$show);// 赋值分页输出 $this->assign('list',$list);// 赋值数据集 $this->display(); // 输出模板 }--------------------------------------------------下面是筛选-------------------------------------------------------------------------------------------------<a href="#" >全部</a> <volist name="list" id="vo"> <a href="/index.php/Zhaopin/index/id/{$vo[id]}">{$vo['Position']}</a> </volist> </dd></dl><dl class="sz_area" id="sbl_"><dt>区域:</dt><dd><a href="停车场.html">全深圳</a> <volist name="list" id="vo"> <a href="/index.php/Zhaopin/index/id/{$vo[id]}">{$vo['Recruitment']}</a> </volist> </dd>-----------------------------------------------------下面是内容-------------------------------------------------------------------------------------<volist name="list" id="vo"><dl class="jobli"><dt> <span class="jobname" style="width:35%;"><a href="/index.php/Zhaopin/show/id/{$vo[id]}">{$vo['Job']|mb_substr=0,8,'UTF-8'}</a></span> <span style="width:30%;"><a href="/index.php/Zhaopin/show/id/{$vo[id]}">{$vo['company_name']}</a></span> <span style="width:16%;">{$vo['Recruitment']}</span> <span style="width:15%;">{$vo['shijian']}</span></dt><dd> <span class="jobinfo"> <b> 招聘人数:{$vo['hiring']}人 公司性质:{$vo['Nature']} 规模:{$vo['company_scale']}人 经验:{$vo['Work_experience']}年 学历:{$vo['Degree_required']} 职位月薪:{$vo['salary']}元/月 </b> <br /> 岗位要求: {$vo['Job_requirements']|mb_substr=0,150,'UTF-8'} </span> <a href="/index.php/Zhaopin/show/id/{$vo[id]}" class="getjob">查看职位</a></dd></dl></volist>
汗,这个xxx没有规定怎么传啊,这个是条件,条件就是你想通过它来限制得到你想要的结果,那我问你,你为什么需要这两个字段来并列筛选呢,为什么不是所有字段都筛选呢!同理,比如你想筛选Position是111的记录,那就是$Data->where("Position = '111'")->select();至于这个111如果是动态传过来的,就像你写的,先获取,再组装到sql
恩 的确是获取到ID了 问题是 下面的内容不变化啊
public function index(){ $Data = M('zhaopin'); // 实例化Data数据对象 import('ORG.Util.Page');// 导入分页类 $count= $Data->where($map)->count();// 查询满足要求的总记录数 $Page= new Page($count,20);// 实例化分页类 传入总记录数 $nowPage = isset($_GET['p'])?$_GET['p']:1; $adi=$_GET['id']; $list = $Data->where($map,"Position = '$aid' and Recruitment = '$aid'")->order('shijian desc,id asc')->page($nowPage.','.$Page->listRows)->select(); $show = $Page->show();// 分页显示输出 $this->assign('page',$show);// 赋值分页输出 $this->assign('list',$list);// 赋值数据集 $this->display(); // 输出模板 }--------------------------------------------------下面是筛选------------------------------------------------------------------------------------------------- <a href="#" >全部</a> <volist name="list" id="vo"> <a href="/index.php/Zhaopin/index/id/{$vo[id]}">{$vo['Position']}</a> </volist> </dd></dl><dl class="sz_area" id="sbl_"><dt>区域:</dt><dd><a href="停车场.html">全深圳</a> <volist name="list" id="vo"> <a href="/index.php/Zhaopin/index/id/{$vo[id]}">{$vo['Recruitment']}</a> </volist> </dd> -----------------------------------------------------下面是内容-------------------------------------------------------------------------------------<volist name="list" id="vo"><dl class="jobli"><dt> <span class="jobname" style="width:35%;"><a href="/index.php/Zhaopin/show/id/{$vo[id]}">{$vo['Job']|mb_substr=0,8,'UTF-8'}</a></span> <span style="width:30%;"><a href="/index.php/Zhaopin/show/id/{$vo[id]}">{$vo['company_name']}</a></span> <span style="width:16%;">{$vo['Recruitment']}</span> <span style="width:15%;">{$vo['shijian']}</span></dt><dd> <span class="jobinfo"> <b> 招聘人数:{$vo['hiring']}人 公司性质:{$vo['Nature']} 规模:{$vo['company_scale']}人 经验:{$vo['Work_experience']}年 学历:{$vo['Degree_required']} 职位月薪:{$vo['salary']}元/月 </b> <br /> 岗位要求: {$vo['Job_requirements']|mb_substr=0,150,'UTF-8'} </span> <a href="/index.php/Zhaopin/show/id/{$vo[id]}" class="getjob">查看职位</a></dd></dl></volist>

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP makes it easy to create interactive web content. 1) Dynamically generate content by embedding HTML and display it in real time based on user input or database data. 2) Process form submission and generate dynamic output to ensure that htmlspecialchars is used to prevent XSS. 3) Use MySQL to create a user registration system, and use password_hash and preprocessing statements to enhance security. Mastering these techniques will improve the efficiency of web development.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP remains important in modern web development, especially in content management and e-commerce platforms. 1) PHP has a rich ecosystem and strong framework support, such as Laravel and Symfony. 2) Performance optimization can be achieved through OPcache and Nginx. 3) PHP8.0 introduces JIT compiler to improve performance. 4) Cloud-native applications are deployed through Docker and Kubernetes to improve flexibility and scalability.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python each have their own advantages and are suitable for different scenarios. 1.PHP is suitable for web development and provides built-in web servers and rich function libraries. 2. Python is suitable for data science and machine learning, with concise syntax and a powerful standard library. When choosing, it should be decided based on project requirements.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version
Useful JavaScript development tools

Notepad++7.3.1
Easy-to-use and free code editor

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.