21,873
社区成员




$st=$_POST['st'];
$et=$_POST['et'];
$or_type=$_POST['or_type'];
$state=$_POST['state'];
//上面是个是传过来的多条件查询,有可能只有一个,也有可能两个
if($_POST) {
$sql="select * from order a left join user b on a.juserid=b.id where a.mbus_id='$bid' and ....这里是传过来的多条件,怎么写?有可能是3个条件,也有可能是3个条件";
}
if(!empty($or_type)){
$sql.=" and a.order_type='$or_type'";
}
if(!empty($state)){
$sql.=" and a.order_state='$or_type'";
}
if(!empty($st) && !empty($et)){
$sql.=" and a.order_data>'$st' and a.order_data<'$et'";
}
我是这样写的,有没有更好的方法