//用户信息搜索
public function search(){
$link = M('course_submission');
$key = trim(I('post.keyword'));
$where['type|num|theme|teacher|date|tel1']=array('like',"%".$key."%");
$count = $link->where($where)->count();// 查询满足要求的总记录数
$Page = new \Think\Page($count,10);// 实例化分页类 传入总记录数和每页显示的记录数(25)
$show = $Page->show();// 分页显示输出// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
$list = $link->where($where)->order(' date desc ')->limit($Page->firstRow.','.$Page->listRows)->select();
//echo $count;
//echo $link->getLastSql();exit;
// dump($list);exit;
$this->assign('res',$list);
$this->assign('page',$show);
$this->display('user_message');
}
用户在输入框输入一个内容,是三个表的内容,不知道SQL语句如何组装呢,求大神,谢谢 最佳答案
