public function search()
{
if(isset($_POST['name']) && $_POST['name']!=null){
$where['name']=array('like',"%{$_POST['name']}%");
}
if(isset($_POST['category']) && $_POST['category']!=null){
$where['category']=array('eq',$_POST['category']);
}
$m=M('download');
$arr=$m->where('status = 0')->where($where)->select();
$this->assign('list',$arr);
$this->display('index');
}我需要做到where查询两个条件,这样写两个where查询不对,如果采用where('$where and status = 0')的话,明显也不对,因为单引号不会解释$where,打双引号也是不多的,求懂的人告知啊,感激不尽! 最佳答案