国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

多重條件組合查詢(二)

2019-11-18 20:41:10
字體:
來源:轉載
供稿:網友
接一來這部分是實現用戶提交之后的查詢結果,也是程序代碼的主體部份:  
<?  
$linkstr=MySQL_connect("localhost","root","sa");  
mysql_select_db("cx",$linkstr);  
$showstr="查詢條件為:";  
$querystring="select no,type,name,qty,PRice from orders";  
switch($select1)  
{  
case 1:  
if (!empty($no))  
{  
switch($select2)  
{  
case 1:  
$querystring.=" where no=".$no;  
$showstr.="訂單為".$no."所有數據";  
break;  
case 2:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." or price<50";  
$showstr.="訂單為".$no."或者價格少于50元的所有數據";  
break;  
case 2:  
$querystring.=" where no=".$no." or price between 50 and 200";  
$showstr.="訂單為".$no."或者價格介于50到200元間的所有數據";  
break;  
case 3:  
$querystring.=" where no=".$no." or price>200";  
$showstr.="訂單為".$no."或者價格大于200元間的所有數據";  
break;  
}  
break;  
case 3:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." and price<50";  
$showstr.="訂單為".$no."并且價格少于50元的所有數據";  
break;  
case 2:  
$querystring.=" where no=".$no." and price between 50 and 200";  
$showstr.="訂單為".$no."并且價格介于50到200元間的所有數據";  
break;  
case 3:  
$querystring.=" where no=".$no." and price>200";  
$showstr.="訂單為".$no."并且價格大于200元間的所有數據";  
break;  
}  
break;  
}  
}  
else  
{  
if (!empty($type))  
{  
switch($select2)  
{  
case 1:  
$querystring.=" where type="".$type."" ";  
$showstr.=" 類型為".$type."所有數據";  
break;  
case 2:  
switch($price)  
{  
case 1:  
$querystring.=" where type="".$type."" or price<50";  
$showstr.="類型為".$type."或者價格少于50元的所有數據";  
break;  
case 2:  
$querystring.=" where type="".$type."" or price between 50 and 200";  
$showstr.="類型為".$type."或者價格介于50到200元間的所有數據";  
break;  
case 3:  
$querystring.=" where type="".$type."" or price>200";  
$showstr.="類型為".$type."或者價格大于200元間的所有數據";  
break;  
}  
break;  
case 3:  
switch($price)  
{  
case 1:  
$querystring.=" where type="".$type."" and price<50";  
$showstr.="類型為".$type."并且價格少于50元的所有數據";  
break;  
case 2:  
$querystring.=" where type="".$type."" and price between 50 and 200";  
$showstr.="類型為".$type."并且價格介于50到200元間的所有數據";  
break;  
case 3:  
$querystring.=" where type="".$type."" and price>200";  
$showstr.="類型為".$type."并且價格大于200元間的所有數據";  
break;  
}  
break;  
}  
}  
else  
{  
switch($price)  
{  
case 1:  
$querystring.=" where price<50";  
$showstr.="價格少于50元的所有數據";  
break;  
case 2:  
$querystring.=" where price between 50 and 200";  
$showstr.="價格介于50到200元間的所有數據";  
break;  
case 3:  
$querystring.=" where price>200";  
$showstr.="價格大于200元間的所有數據";  
break;  
}  
}  
}  
break;  
case 2:  
switch($select2)  
{  
case 1:  
$querystring.=" where no=".$no." or type="".$type.""";  
$showstr.="訂單為".$no."或者類別為".$type."所有數據";  
break;  
case 2:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." or type="".$type."" or price<50 ";  
$showstr.="訂單為".$no."或者類別為".$type."或者價格少于50元的所有數據";  
break;  
case 2:  
$querystring.=" where no=".$no." or type="".$type."" or price between 50 and 200";  
$showstr.="訂單為".$no."或者類別為".$type."或者價格介于50到200元間的所有數據";  
break;  
case 3:  
$querystring.=" where no=".$no."or type="".$type."" or price>200";  
$showstr.="訂單為".$no."或者類別為".$type."或者價格大于200元間的所有數據";  
break;  
}  
break;  
case 3:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." or type="".$type."" and price<50 ";  
$showstr.="訂單為".$no."或者類別為".$type."并且價格少于50元的所有數據";  
break;  
case 2:  
$querystring.=" where no=".$no." or type="".$type."" and price between 50 and 200";  
$showstr.="訂單為".$no."或者類別為".$type."并且價格介于50到200元間的所有數據";  
break;  
case 3:  
$querystring.=" where no=".$no."or type="".$type."" and price>200";  
$showstr.="訂單為".$no."或者類別為".$type."并且價格大于200元間的所有數據";  
break;  
}  
break;  
}  
break;  
case 3:  
switch($select2)  
{  
case 1:  
$querystring.=" where no=".$no." and type="".$type.""";  
$showstr.="訂單為".$no."并且類別為".$type."所有數據";  
break;  
case 2:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." and type="".$type."" or price<50 ";  
$showstr.="訂單為".$no."并且類別為".$type."或者價格少于50元的所有數據";  
break;  
case 2:  
$querystring.=" where no=".$no." and type="".$type."" or price between 50 and 200";  
$showstr.="訂單為".$no."并且類別為".$type."或者價格介于50到200元間的所有數據";  
break;  
case 3:  
$querystring.=" where no=".$no."and type="".$type."" or price>200";  
$showstr.="訂單為".$no."并且類別為".$type."或者價格大于200元間的所有數據";  
break;  
}  
break;  
case 3:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." and type="".$type."" and price<50 ";  
$showstr.="訂單為".$no."并且類別為".$type."并且價格少于50元的所有數據";  
break;  
case 2:  
$querystring.=" where no=".$no." and type="".$type."" and price between 50 and 200";  
$showstr.="訂單為".$no."并且類別為".$type."并且價格介于50到200元間的所有數據";  
break;  
case 3:  
$querystring.=" where no=".$no."and type="".$type."" and price>200";  
$showstr.="訂單為".$no."并且類別為".$type."并且價格大于200元間的所有數據";  
break;  
}  
break;  
}  
break;  
}  
$result=mysql_query($querystring,$linkstr);  
echo "<p>$showstr:<p>  
";  
if (@mysql_num_rows($result)>0)  
{  
while (list($no,$type,$name,$qty,$price)=mysql_fetch_row($result))  
{  
echo "<table align="center">";  
echo "<tr>";  
echo "<td>訂單編號</td>";  
echo "<td>$no</td>";  
echo "</tr>";  
echo "<tr>";  
echo "<td>類別</td>";  
echo "<td>$type</td>";  
echo "</tr>";  
echo "<tr>";  
echo "<td>配件</td>";  
echo "<td>$name</td>";  
echo "</tr>";  
echo "<tr>";  
echo "<td>數量</td>";  
echo "<td>$qty</td>";  
echo "</tr>";  
echo "<tr>";  
echo "<td>價格</td>";  
echo "<td>$price</td>";  
echo "</tr>";  
echo "</table>";  
}  
}  
?>  

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新蔡县| 葫芦岛市| 乌苏市| 靖州| 定兴县| 东山县| 太谷县| 安义县| 乐都县| 罗甸县| 罗江县| 汝南县| 兴安县| 同仁县| 昔阳县| 克拉玛依市| 施秉县| 尉氏县| 钟祥市| 秦安县| 乌海市| 定兴县| 岑巩县| 三明市| 黎城县| 宜兴市| 磐石市| 靖安县| 奈曼旗| 宁津县| 陕西省| 宝山区| 六枝特区| 海安县| 通许县| 梁平县| 阳谷县| 张家界市| 保德县| 石首市| 涞源县|