接一來這部分是實現用戶提交之后的查詢結果,也是程序代碼的主体部份:
<?
外地车进京规定2018
$linkstr=mysql_connect(“localhost”,”root”,”sa”);
mysql_lect_db(“cx”,$linkstr);
$showstr=”查詢條件為:”;
$querystring=”lect no,type,name,qty,price from orders”;
switch($lect1)
{
ca 1:
if (!empty($no))
{
switch($lect2)
{
ca 1:
$querystring.=” where no=”.$no;
$showstr.=”訂單為”.$no.”所有數据”;
break;
ca 2:
switch($price)
{
ca 1:
$querystring.=” where no=”.$no.” or price<50″;
$showstr.=”訂單為”.$no.”或者价格少于50元的所有數据”;
break;
ca 2:
$querystring.=” where no=”.$no.” or price between 50 and 200″;
$showstr.=”訂單為”.$no.”或者价格介于50到200元間的所有數据”;
break;
ca 3:
$querystring.=” where no=”.$no.” or price>200″;
$showstr.=”訂單為”.$no.”或者价格大于200元間的所有數据”;
break;
}
break;
ca 3:
switch($price)
{
ca 1:
$querystring.=” where no=”.$no.” and price<50″;
$showstr.=”訂單為”.$no.”并且价格少于50元的所有數据”;
break;
ca 2:
$querystring.=” where no=”.$no.” and price between 50 and 200″;
$showstr.=”訂單為”.$no.”并且价格介于50到200元間的所有數据”;
break;
ca 3:
$querystring.=” where no=”.$no.” and price>200″;
$showstr.=”訂單為”.$no.”并且价格大于200元間的所有數据”;
break;
}
break;
}
}
el
{
if (!empty($type))
{
switch($lect2)
{
ca 1:
$querystring.=” where type=””.$type.”” “;
$showstr.=” 類型為”.$type.”所有數据”;
break;
ca 2:
switch($price)
{
ca 1:
$querystring.=” where type=””.$type.R端午手抄报图片21;” or price<50″;
$showstr.=”類型為”.$type.”或者价格少于50元的所有數据”;
break;
ca 2:
$querystring.=” wher阳虚吃什么e type=””.$type.”” or price between 50 and 200″;
$showstr.=”類型為”.$type.”或者价格介于50到200元間的所有數据”;
break;
ca 3:
$querystring.=” where type=””.$type.”” or price>200″;
$showstr.=”類型為”.$type.”或者价格大于200元間的所有數据”;
break;
}
break;
ca 3:
switch($price)
{
ca 1:
$querystring.=” where type=””.$type.”” and price<50″;
$showstr.=”類型為”.$type.”并且价格少于50元的所有數据”;
break;
ca 2:
$querystring.=” where type=””.$type.”” and price between 50 and 200″;
$showstr.=”類型為”.$type.”并且价格介于50到200元間的所有數据”;
break;
ca 3:
$querystring.=” where type=””.$type.”” and price>200″;
$showstr.=”類型為”.$type.”并且价格大于200元間的所有數据”;
break;
}
break;
}
}
el
{
switch($price)
{
ca 1:
$querystring.=” where price<50″;
$showstr.=”价格少于50元的所有數据”;
break;
c孝感学院a 2:
$querystring.=” where price between 50 and 200″;
$showstr.=”价格介于50到200元間的所有數据”;
break;
ca 3:
$querystring.=” where price>200″;
$showstr.=”价格大于200元間的所有數据”;
break;
}
}
}
break;
ca 2:
switch($lect2)
{
ca 1:
$querystring.=” where no=”.$no.” or type=””.$type.”””;
$showstr.=”訂單為”.$no.”或者類別為”.$type.”所有數据”;
break;
ca 2:
switch($price)
{
ca 1:
$querystring.=” where no=”.$no.” or type=””.$type.”” or price<50 “;
$showstr.=”訂單為”.$no.”或者類別為”.$type.”或者价格少于50元的所有數据”;
break;
ca 2:
$querystring.=” where no=”.$no.” or type=””.$type.”” or price between 50 and 200″;
$showstr.=”訂單為”.$no.”或者類別為”.$type.”或者价格介于50到200元間的所有數据”;
break;
ca 3:
$querystring.=” where no=”.$no.”or type=””.$type.”” or price>200″;
$showstr.=”訂單為”.$no.”或者類別為”.$type.”或者价格大于200元間的所有數据”;
break;
}
break;
ca 3:
switch($price)
{
ca 1:
$querystring.=” where no=”.$no.” or type=””.$type.”” and price<50 “;
$showstr.=”訂單為”.$no.”或者類別為”.$type.”并且价格少于50元的所有數据”;
break;
ca 2:
$querystring.=” where no=”.$no.” or type=””.$type.”” and price between 50 and 200″;
$showstr.=”訂單為”.$no.”或者類別為”.$type.”并且价格介于50到200元間的所有數据”;
break;
ca 3:
$querystring.=” where no=”.$no.”or type=””.$type.”” and price>200″;
$showstr.=”訂單為”.$no.”或者類別為”.$type.”并且价格大于200元間的所有數据”;
break;
}
break;
}
break;
ca 3:
switch($lect2)
{
ca 1:
$querystring.=” where no=”.$no.” and type=””.$type.”””;
$showstr.=”訂單為”.$no.”并且類別為”.$type.”所有數据”;
break;
ca 2:
switch($price)
{
ca 1:
$querystring.=” where no=”.$no.” and type=””.$type.”” or price<50 “;
$showstr.=”訂單為”.$no.”并且類別為”.$type.”或者价格少于50元的所有數据”;
break;
ca 2:
$querystring.=” where no=”.$no.” and type=””.$type.”” or price between 50 and 200″;
$showstr.=”訂單為”.$no.”并且類別為”.$type.”或者价格介于50到200元間的所有數据”;
break;
ca 3:
$querystring.=” where no=”.$no.”and type=””.$type.”” or price>200″;
$showstr.=”訂單為”.$no.”并且類別為”.$type.”或者价格大于200元間的所有數据”;
break;
}
break;
ca 3:
switch($price)
{
ca 1:
$querystring.=” where no=”.$no.” and type=””.$type.”” and price<50 “;
$showstr.=”訂單為”.$no.”并且類別為”.$type.”并且价格少于50元的所有數据”;
break;
ca 2:
$querystring.=” where no=”.$no.” and type=””.$type.”” and price between 50 and 200″;
$showstr.=”訂單為”.$no.”并且類別為”.$type.”并且价格介于50到200元間的所有數据”;
break;
ca 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_r电磁炉故障ows($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>”;
}
}
?>
本文发布于:2023-04-06 06:07:28,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/91b2c96a9bf83b6663a6a2e2d1df17ce.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:多重條件組合查詢(二).doc
本文 PDF 下载地址:多重條件組合查詢(二).pdf
留言与评论(共有 0 条评论) |