Next, this part is to implement the query results after the user submits it, which is also the main part of the program code:
$linkstr=mysql_connect("localhost","root","sa");
mysql_select_db("cx",$linkstr);
$showstr="The query condition is:";
$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.="The order is ".$no."All data";
break;
case 2:
switch( $price)
{
case 1:
$querystring.=" where no=".$no." or price<50";
$showstr.="The order is ".$no ."or all data with a price less than 50 yuan";
break;
case 2:
$querystring.=" where no=".$no." or price between 50 and 200";
$showstr.="All data where the order is ".$no." or the price is between 50 and 200 yuan";
break;
case 3:
$querystring.=" where no =".$no." or price>200";
$showstr.="All data between orders with ".$no." or price greater than 200 yuan";
break;
}
break; ;
$showstr.="All data where the order is ".$no." and the price is less than 50 yuan";
break;
case 2:
$querystring.=" where no= ".$no." and price between 50 and 200";
$showstr.="All data where the order is ".$no." and the price is between 50 and 200 yuan";
break;
case 3:
$querystring.=" where no=".$no." and price>200";
$showstr.="The order is ".$no." and the price is greater than 200 yuan All data";
break;
}
break; {
switch($select2)
{
case 1:
$querystring.=" where type="".$type."" ";
$showstr.=" The type is ".$type."All data";
break;
case 2:
switch($price)
{
case 1:
$querystring.=" where type= "".$type."" or price<50";
$showstr.="All data with type ".$type." or price less than 50 yuan";
break;
case 2:
$querystring.=" where type="".$type."" or price between 50 and 200";
$showstr.=" where type="".$type."" or price between 50 and 200"; to 200 yuan";
break;
case 3:
$querystring.=" where type="".$type."" or price>200";
$showstr .="All data with type ".$type." or price greater than 200 yuan";
break;
}
break;
case 3:
switch($price)
{
case 1:
$querystring.=" where type="".$type."" and price<50";
$showstr.=" where type is ".$type." "All data with price less than 50 yuan";
break;
case 2:
$querystring.=" where type="".$type."" and price between 50 and 200";
$showstr.="All data of type ".$type." and price between 50 and 200 yuan";
break;
case 3:
$querystring.=" where type="".$type."" and price>200";
$showstr.="All data with type ".$type." and price greater than 200 yuan";
break;
}
break;
}
}
else
{
switch($price)
{
case 1:
$querystring.=" where price<50";
$showstr.="price less All data above 50 yuan";
break;
case 2:
$querystring.=" where price between 50 and 200";
$showstr.=" where price is between 50 and 200 yuan "All data between";
break;
case 3:
$querystring.=" where price>200"; 🎜>break;
}
}
}
break; .=" where no=".$no." or type="".$type.""";
$showstr.="The order is ".$no." or the category is ".$type." All data";
break;
case 2:
switch($price)
{
case 1:
$querystring.=" where no=".$no." or type="".$type."" or price<50 ";
$showstr.="All orders with ".$no." or category ".$type." or price less than 50 yuan data";
break;
case 2:
$querystring.=" where no=".$no." or type="".$type."" or price between 50 and 200";
$showstr.="All data where the order is ".$no." or the category is ".$type." or the price is between 50 and 200 yuan";
break;
case 3:
$querystring.=" where no=".$no."or type="".$type."" or price>200";
$showstr.="The order is ".$no." Or all data with category ".$type." or price greater than 200 yuan";
break;
}
break;
case 3:
switch($price)
{
case 1:
$querystring.=" where no=".$no." or type="".$type."" and price<50 ";
$showstr.=" All data with order ".$no." or category ".$type." and price less than 50 yuan";
break;
case 2:
$querystring.=" where no= ".$no." or type="".$type."" and price between 50 and 200";
$showstr.="The order is ".$no." or the category is ".$type." And all data with a price between 50 and 200 yuan";
break;
case 3:
$querystring.=" where no=".$no."or type="".$type ."" and price>200";
$showstr.="All data between the order is ".$no." or the category is ".$type." and the price is greater than 200 yuan";
break;
}
break;
}
break; where no=".$no." and type="".$type.""";
$showstr.="The order is ".$no." and the category is ".$type."All data" ;
break;
case 2:
switch($price)
{
case 1:
$querystring.=" where no=".$no." and type= "".$type."" or price<50 ";
$showstr.="All data where the order is ".$no." and the category is ".$type." or the price is less than 50 yuan";
break;
case 2:
$querystring.=" where no=".$no." and type="".$type."" or price between 50 and 200";
$showstr.="All data where the order is ".$no." and the category is ".$type." or the price is between 50 and 200 yuan";
break;
case 3:
$querystring.=" where no=".$no."and type="".$type."" or price>200";
$showstr.="The order is ".$no." and the category is ".$type." or all data with a price greater than 200 yuan";
break;
}
break;
case 3:
switch($price)
{
case 1:
$querystring.=" where no=".$no." and type=" ".$type."" and price<50 ";
$showstr.="All data where the order is ".$no." and the category is ".$type." and the price is less than 50 yuan";
break;
case 2:
$querystring.=" where no=".$no." and type="".$type."" and price between 50 and 200";
$ showsr.="All data where the order is ".$no." and the category is ".$type." and the price is between 50 and 200 yuan";
break;
case 3:
$ querystring.=" where no=".$no."and type="".$type."" and price>200";
$showstr.="The order is ".$no." and the category is " .$type."All data with price greater than 200 yuan";
break;
}
break;
}
break; ($querystring,$linkstr);
echo "
$showstr:
";
if (@mysql_num_rows($result)>0)
{
while (list($no,$type,$name,$qty,$price)=mysql_fetch_row($result))
{
echo "
Order number | "; ;/tr>";|
category | "; ;|
Accessories | "; $name";|
quantity | "; >echo "$qty | ";
$price | ";
http: //www.bkjia.com/PHPjc/315369.html