多重条件组合查询_PHP

WBOY
Release: 2016-06-01 12:32:15
Original
1836 people have browsed it

平常我們在開發系統時,一定不會缺少查詢功能,然而往往算個條件是無法滿足用戶的要求的,這時我們就應該設置多重條件進行組合,讓用戶查詢時以更加方便地選擇查詢條件,迅速找到他們所滿足的記錄.
現在我們假設開發一個鐘表公司的客戶訂單系統,有客戶訂單編號,類別,名稱,數量,价格等資料,這里就不將資料一一列擊,.訂單表如下:
訂單編號(ID) 類別(TYPE) 名稱(NAME) 數量(QTY) 价格(PRICE)
001 机芯 机芯1 100 100
001 表殼 表殼1 1000 30
001 表帶 表帶1 500 60
002 机芯 机芯2 200 150
002 表殼 表殼2 500 40
002 表帶 表帶2 300 70
現在我們設想要建一個查詢系統,讓用戶即可根据訂單編號,也可根据類別,或者根据价格,或者其中的各自組合來實現快速查詢,代號如下:
下面此部分是顯示查詢條件的窗体


$linkstr=mysql_connect("localhost","root","sa");
mysql_select_db("cx",$linkstr);
?>



多重條件組合查詢

















訂單編號

類別為



价格位在
的配件












摘自:PHP中文用户
作者:Hafele
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!