人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當(dāng)前位置:蘿卜系統(tǒng)下載站 > 技術(shù)開發(fā)教程 > 詳細(xì)頁面

多重條件組合查詢(二)

多重條件組合查詢(二)

更新時間:2022-08-02 文章作者:未知 信息來源:網(wǎng)絡(luò) 閱讀次數(shù):

接一來這部分是實現(xiàn)用戶提交之后的查詢結(jié)果,也是程序代碼的主體部份:  
<?  
$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."所有數(shù)據(jù)";  
break;  
case 2:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." or price<50";  
$showstr.="訂單為".$no."或者價格少于50元的所有數(shù)據(jù)";  
break;  
case 2:  
$querystring.=" where no=".$no." or price between 50 and 200";  
$showstr.="訂單為".$no."或者價格介于50到200元間的所有數(shù)據(jù)";  
break;  
case 3:  
$querystring.=" where no=".$no." or price>200";  
$showstr.="訂單為".$no."或者價格大于200元間的所有數(shù)據(jù)";  
break;  
}  
break;  
case 3:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." and price<50";  
$showstr.="訂單為".$no."并且價格少于50元的所有數(shù)據(jù)";  
break;  
case 2:  
$querystring.=" where no=".$no." and price between 50 and 200";  
$showstr.="訂單為".$no."并且價格介于50到200元間的所有數(shù)據(jù)";  
break;  
case 3:  
$querystring.=" where no=".$no." and price>200";  
$showstr.="訂單為".$no."并且價格大于200元間的所有數(shù)據(jù)";  
break;  
}  
break;  
}  
}  
else  
{  
if (!empty($type))  
{  
switch($select2)  
{  
case 1:  
$querystring.=" where type="".$type."" ";  
$showstr.=" 類型為".$type."所有數(shù)據(jù)";  
break;  
case 2:  
switch($price)  
{  
case 1:  
$querystring.=" where type="".$type."" or price<50";  
$showstr.="類型為".$type."或者價格少于50元的所有數(shù)據(jù)";  
break;  
case 2:  
$querystring.=" where type="".$type."" or price between 50 and 200";  
$showstr.="類型為".$type."或者價格介于50到200元間的所有數(shù)據(jù)";  
break;  
case 3:  
$querystring.=" where type="".$type."" or price>200";  
$showstr.="類型為".$type."或者價格大于200元間的所有數(shù)據(jù)";  
break;  
}  
break;  
case 3:  
switch($price)  
{  
case 1:  
$querystring.=" where type="".$type."" and price<50";  
$showstr.="類型為".$type."并且價格少于50元的所有數(shù)據(jù)";  
break;  
case 2:  
$querystring.=" where type="".$type."" and price between 50 and 200";  
$showstr.="類型為".$type."并且價格介于50到200元間的所有數(shù)據(jù)";  
break;  
case 3:  
$querystring.=" where type="".$type."" and price>200";  
$showstr.="類型為".$type."并且價格大于200元間的所有數(shù)據(jù)";  
break;  
}  
break;  
}  
}  
else  
{  
switch($price)  
{  
case 1:  
$querystring.=" where price<50";  
$showstr.="價格少于50元的所有數(shù)據(jù)";  
break;  
case 2:  
$querystring.=" where price between 50 and 200";  
$showstr.="價格介于50到200元間的所有數(shù)據(jù)";  
break;  
case 3:  
$querystring.=" where price>200";  
$showstr.="價格大于200元間的所有數(shù)據(jù)";  
break;  
}  
}  
}  
break;  
case 2:  
switch($select2)  
{  
case 1:  
$querystring.=" where no=".$no." or type="".$type.""";  
$showstr.="訂單為".$no."或者類別為".$type."所有數(shù)據(jù)";  
break;  
case 2:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." or type="".$type."" or price<50 ";  
$showstr.="訂單為".$no."或者類別為".$type."或者價格少于50元的所有數(shù)據(jù)";  
break;  
case 2:  
$querystring.=" where no=".$no." or type="".$type."" or price between 50 and 200";  
$showstr.="訂單為".$no."或者類別為".$type."或者價格介于50到200元間的所有數(shù)據(jù)";  
break;  
case 3:  
$querystring.=" where no=".$no."or type="".$type."" or price>200";  
$showstr.="訂單為".$no."或者類別為".$type."或者價格大于200元間的所有數(shù)據(jù)";  
break;  
}  
break;  
case 3:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." or type="".$type."" and price<50 ";  
$showstr.="訂單為".$no."或者類別為".$type."并且價格少于50元的所有數(shù)據(jù)";  
break;  
case 2:  
$querystring.=" where no=".$no." or type="".$type."" and price between 50 and 200";  
$showstr.="訂單為".$no."或者類別為".$type."并且價格介于50到200元間的所有數(shù)據(jù)";  
break;  
case 3:  
$querystring.=" where no=".$no."or type="".$type."" and price>200";  
$showstr.="訂單為".$no."或者類別為".$type."并且價格大于200元間的所有數(shù)據(jù)";  
break;  
}  
break;  
}  
break;  
case 3:  
switch($select2)  
{  
case 1:  
$querystring.=" where no=".$no." and type="".$type.""";  
$showstr.="訂單為".$no."并且類別為".$type."所有數(shù)據(jù)";  
break;  
case 2:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." and type="".$type."" or price<50 ";  
$showstr.="訂單為".$no."并且類別為".$type."或者價格少于50元的所有數(shù)據(jù)";  
break;  
case 2:  
$querystring.=" where no=".$no." and type="".$type."" or price between 50 and 200";  
$showstr.="訂單為".$no."并且類別為".$type."或者價格介于50到200元間的所有數(shù)據(jù)";  
break;  
case 3:  
$querystring.=" where no=".$no."and type="".$type."" or price>200";  
$showstr.="訂單為".$no."并且類別為".$type."或者價格大于200元間的所有數(shù)據(jù)";  
break;  
}  
break;  
case 3:  
switch($price)  
{  
case 1:  
$querystring.=" where no=".$no." and type="".$type."" and price<50 ";  
$showstr.="訂單為".$no."并且類別為".$type."并且價格少于50元的所有數(shù)據(jù)";  
break;  
case 2:  
$querystring.=" where no=".$no." and type="".$type."" and price between 50 and 200";  
$showstr.="訂單為".$no."并且類別為".$type."并且價格介于50到200元間的所有數(shù)據(jù)";  
break;  
case 3:  
$querystring.=" where no=".$no."and type="".$type."" and price>200";  
$showstr.="訂單為".$no."并且類別為".$type."并且價格大于200元間的所有數(shù)據(jù)";  
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>數(shù)量</td>";  
echo "<td>$qty</td>";  
echo "</tr>";  
echo "<tr>";  
echo "<td>價格</td>";  
echo "<td>$price</td>";  
echo "</tr>";  
echo "</table>";  
}  
}  
?>  

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統(tǒng)下載排行

網(wǎng)站地圖xml | 網(wǎng)站地圖html
主站蜘蛛池模板: 会理县| 永胜县| 五寨县| 清水县| 裕民县| 扎赉特旗| 永春县| 郓城县| 双峰县| 岳阳市| 平邑县| 耒阳市| 望奎县| 长岭县| 宣武区| 邳州市| 韩城市| 哈巴河县| 成都市| 密山市| 开阳县| 辽源市| 绍兴市| 阆中市| 通化县| 壶关县| 章丘市| 拜泉县| 南澳县| 临高县| 刚察县| 丁青县| 收藏| 成安县| 乌鲁木齐市| 溧阳市| 安多县| 东莞市| 登封市| 沙田区| 云龙县|