Multiple condition combination query (2)_PHP tutorial
Jul 21, 2016 pm 04:06 PM
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
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/315369.html

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The default map on the iPhone is Maps, Apple's proprietary geolocation provider. Although the map is getting better, it doesn't work well outside the United States. It has nothing to offer compared to Google Maps. In this article, we discuss the feasible steps to use Google Maps to become the default map on your iPhone. How to Make Google Maps the Default Map in iPhone Setting Google Maps as the default map app on your phone is easier than you think. Follow the steps below – Prerequisite steps – You must have Gmail installed on your phone. Step 1 – Open the AppStore. Step 2 – Search for “Gmail”. Step 3 – Click next to Gmail app

How to set up keyboard startup on Gigabyte's motherboard. First, if it needs to support keyboard startup, it must be a PS2 keyboard! ! The setting steps are as follows: Step 1: Press Del or F2 to enter the BIOS after booting, and go to the Advanced (Advanced) mode of the BIOS. Ordinary motherboards enter the EZ (Easy) mode of the motherboard by default. You need to press F7 to switch to the Advanced mode. ROG series motherboards enter the BIOS by default. Advanced mode (we use Simplified Chinese to demonstrate) Step 2: Select to - [Advanced] - [Advanced Power Management (APM)] Step 3: Find the option [Wake up by PS2 keyboard] Step 4: This option The default is Disabled. After pulling down, you can see three different setting options, namely press [space bar] to turn on the computer, press group

C++ is a widely used programming language that is very convenient and practical in writing countdown programs. Countdown program is a common application that can provide us with very precise time calculation and countdown functions. This article will introduce how to use C++ to write a simple countdown program. The key to implementing a countdown program is to use a timer to calculate the passage of time. In C++, we can use the functions in the time.h header file to implement the timer function. The following is the code for a simple countdown program

Do you frequently visit the same website at about the same time every day? This can lead to spending a lot of time with multiple browser tabs open and cluttering the browser while performing daily tasks. Well, how about opening it without having to launch the browser manually? It's very simple and doesn't require you to download any third-party apps, as shown below. How do I set up Task Scheduler to open a website? Press the key, type Task Scheduler in the search box, and then click Open. Windows On the right sidebar, click on the Create Basic Task option. In the Name field, enter the name of the website you want to open and click Next. Next, under Triggers, click Time Frequency and click Next. Select how long you want the event to repeat and click Next. Select enable

Is the clock app missing from your phone? The date and time will still appear on your iPhone's status bar. However, without the Clock app, you won’t be able to use world clock, stopwatch, alarm clock, and many other features. Therefore, fixing missing clock app should be at the top of your to-do list. These solutions can help you resolve this issue. Fix 1 – Place the Clock App If you mistakenly removed the Clock app from your home screen, you can put the Clock app back in its place. Step 1 – Unlock your iPhone and start swiping to the left until you reach the App Library page. Step 2 – Next, search for “clock” in the search box. Step 3 – When you see “Clock” below in the search results, press and hold it and

Given a square matrix M[r][c], where "r" is a certain number of rows and "c" are columns such that r=c, we have to check if "M" is the identity matrix. Identity matrix Identity matrix is ??also known as identity matrix of size nxn square matrix in which the integer value of diagonal elements is 1 and the integer value of non-diagonal elements is 0 like the example given below-$$I1=\ begin{bmatrix}1\end{bmatrix},\I2=\begin{bmatrix}1&0\0&1\end{bmatrix},\I3=\begin{bmatrix}1&0&0\0&1&0\0&

1. Processor When choosing a computer configuration, the processor is one of the most important components. For playing games like CS, the performance of the processor directly affects the smoothness and response speed of the game. It is recommended to choose Intel Core i5 or i7 series processors because they have powerful multi-core processing capabilities and high frequencies, and can easily cope with the high requirements of CS. 2. Graphics card Graphics card is one of the important factors in game performance. For shooting games such as CS, the performance of the graphics card directly affects the clarity and smoothness of the game screen. It is recommended to choose NVIDIA GeForce GTX series or AMD Radeon RX series graphics cards. They have excellent graphics processing capabilities and high frame rate output, and can provide a better gaming experience. 3. Memory power

Are you getting "Unable to allow access to camera and microphone" when trying to use the app? Typically, you grant camera and microphone permissions to specific people on a need-to-provide basis. However, if you deny permission, the camera and microphone will not work and will display this error message instead. Solving this problem is very basic and you can do it in a minute or two. Fix 1 – Provide Camera, Microphone Permissions You can provide the necessary camera and microphone permissions directly in settings. Step 1 – Go to the Settings tab. Step 2 – Open the Privacy & Security panel. Step 3 – Turn on the “Camera” permission there. Step 4 – Inside, you will find a list of apps that have requested permission for your phone’s camera. Step 5 – Open the “Camera” of the specified app
