要离职了,所以最近写的博客比较多,都是对以前的总结,一想起来好多之前功能没及时整理,就好懊恼:
一、根据前端输入的一些值进行查询
总的思路是:获取前端的值,然后拼接一个where的字符串,然后把这个字符串当做where的条件,代码如下:
public function check()
{
if($_POST){
$school=$_POST['s_id']; //学校id
$work_state=$_POST['work_state']; //在职状态
// $department=$_POST['department']; //部门
$position=$_POST['position']; //职位
$dateBegin=$_POST['dateBegin']; //开始时间
$dateEnd=$_POST['dateEnd']; //结束时间
$conditions=$_POST['conditions']; //具体的搜索条件
//
$where="t.school=".$school.' AND t.archives_status=1 and t.is_del<>'."'2'";//必须是没有删除的,2为删除
if(!empty($work_state)) $where.=' and t.work_state='."'$work_s