$sql="select *,(select price from product_stock where pid=product.id order by price limit 1) as prices,(select id from product_stock where pid=product.id order by price limit 1) as pid from product where state=1 and cover!=''";
if($sid!=""){
$typeclass=mysqli_query($connection,"select * from typeclass where id in ($sid)");
$str="";
while($row=mysqli_fetch_array($typeclass)){
$str.="or sid in (select id from typeclass where refpath like '".$row["refpath"]."%' )";
}
$sql.=" and ( ".substr($str, 2).")";
}
if($name!=""){
$sql.=" and name like '%".$name."%'";
}
if($brand!=""){
$sql.=" and bid in (".$brand.")";
}
if($lb!=""){
$sql.=" and id in (select pid from labelbyproduct where lid=".$lb.")";
}
$sql.=" order by addtime desc limit ".(($page-1)*12).",12";
$result=mysqli_query($connection,$sql);
while($row=mysqli_fetch_array($result)){
?>
$kills=mysqli_query($connection,"select * from kills where endtime >= now() and state=1 and pid in (select id from product_stock where pid=".$row["id"].")");
if(mysqli_num_rows($kills)>0){
$killsinfo=mysqli_fetch_array($kills);
?>
=$killsinfo["discount"]?>折
" class="quick-view">查看
$=(int)($row["prices"]*($killsinfo["discount"]*0.1))?>
$=$row["prices"]?>
for ($x=1; $x<=$row["level"]; $x++) {
echo "";
}
?>
=$row["level"]?> Review(s)
$pic = explode(',',$row["cover"]);
echo "
加入購物車";
?>
}else{
?>
$date=floor((time()-strtotime($row["addtime"]))/86400);
if($date<7){
echo "
new";
}
?>
" class="quick-view">查看
$=$row["prices"]?>
for ($x=1; $x<=$row["level"]; $x++) {
echo "";
}
?>
=$row["level"]?> Review(s)
$pic = explode(',',$row["cover"]);
echo "
加入購物車";
?>
}
?>
}
?>