把他的sql查询的写死的变量, 你用搜索穿过的替换掉就可以了啊,
sql的 where根据筛选条件改变而改变,举个例子:
$filter['brand'] = isset($_request['brand']) ? trim($_request['brand']) : '';//品牌
$filter['price'] = isset($_request['price']) ? trim($_request['price']) : '';//价格
$filter['attribute'] = isset($_request['attribute']) ? trim($_request['attribute']) : '';//属性
$where = " where 1";
if($filter['brand'] != ''){
$where .= " and brand=" . addslashes($filter['brand']);
}
if($filter['price'] != ''){
$where .= " and price=" . addslashes($filter['price']);
}
if($filter['attribute'] != ''){
$where .= " and attribute=" . addslashes($filter['attribute']);
}