How to create a query report database in PHP: MSD table: Fields in PURTC and PURTDPURTC: Fields in PURTD: ---------------------------- condition area -------------------------------------- how to create a query report in PHP
Database: MSD
Table: PURTC, PURTD
Fields in PURTC:
Fields in PURTD:
------------------------------ Condition zone -----------------------------------
---------------------------- Data display area ----------------------------------
Hope you can provide the source code. thank you.
------ Solution --------------------
Isn't it a question about dynamically generating query conditions?
Basic query command:
Select * from PURTC, PURTD where tc001 = td001 and tc002 = td002
Adjusted according to output requirements
If the form is set to post, the form object and field have the same name. the submit button is not named.
Generate code
$ S = '';
Foreach ($ _ POST as $ k => $ v ){
If (! Empty ($ v) $ s. = "and $ k = '$ V '";
}
After attaching $ s to the basic command, query and display
Please add your own legality verification code
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service