How to make a query report in PHP

Source: Internet
Author: User
Database: MSD
Table: PURTC, PURTD
Fields in the PURTC:


Fields in the PURTD:


------------------------------Criteria Area-----------------------------------


----------------------------Data Display Area----------------------------------


Hope can give the source code, thank you


Reply to discussion (solution)

Don't say anything else, just this database design, there is no desire to write code

In fact, this is ding-jie's easy-to-fly ERP system database, I just list part of the field for reference, I am just a rookie, do not know what kind of database design to hook up your desire to write code ....

Upstairs should expect the field name to be at least in English.

Long Insight:)

Since it is someone else's ERP system landlord or look at their data table structure it

I know a lot about their table structure, but my problem seems to have little contact with the table structure.

With "single" as the association, even the table query is OK.


This data sheet design does have a problem,
Two tables unexpectedly have only one field of type numeric.
Many columns are actually enumerated values. If the value is an enumeration value, it should not be defined directly as a char or varchar type. You can use the tinyint type to make a label, and then add a table associated with the table.

This guarantees consistency of the data, and because it is a numeric type, the query is fast as a where Condition filter or association key.

From the design paradigm, the serious non-conformance, from the actual use of the point of view, there is no benefit. Do not think that this is the system of XX, their code must be good. Especially the domestic program code.

With "single" as the association, even the table query is OK.


This data sheet design does have a problem,
Two tables unexpectedly have only one field of type numeric.
Many columns are actually enumerated values. If the value is an enumeration value, it should not be defined directly as a char or varchar type. You can use the tinyint type to make a label, and then add a table associated with the table.

This ensures consistency of the data, and because it is a numeric type, as a Where Condition filter or association key, the query speed will be very ...



Thank you for your analysis, can according to my question to give the detailed code, what I really want is: when click the Query button in the conditional area, how can I make it according to the criteria I fill in the query?

Reference 7 Floor Shadowsniper reply: With "single" as the association, even the table query can be.


This data sheet design does have a problem,
Two tables unexpectedly have only one field of type numeric.
Many columns are actually enumerated values. If the value is an enumeration value, it should not be defined directly as a char or varchar type. You can use the tinyint type to make a label, and then add a table associated with the table.

This ensures consistency of the data, and because it is a numerical type ...

The landlord really want to report class or to query???

Yes, what is the function of demand?


Query by the conditions set here to get the result data and pagination

Querying is nothing more than connecting where sub-statements
Single SELECT * from user where userid=?
Multiple select * from user where userid=? && username=?
The same is true of the multiple-table query principle for complex points.
You can get the data you want from the database, and the next thing you love is how to deal with it. Includes paging processing.

Isn't it just a question of dynamically generating query conditions?

Basic Query directives:
SELECT * from PURTC, PURTD where tc001=td001 and tc002=td002
Self-adjusting according to output requirements

Set the form to post, the form object has the same name as the field, the Submit button is not named
Generate code
$s = ";
foreach ($_post as $k = = $v) {
if (! empty ($v)) $s. = "and $k = ' $v '";
}
After attaching the $s to the underlying instruction, query, display
Please add your own legitimacy verification code

The upstairs all said ~ ~ Knot Paste

But I still can not ah, can you put all the code up?

Fill in the water, download to point

Feel finereport query function can be achieved without coding, you need to suggest or best use finereport do see it ~

  • Related Article

    Contact Us

    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

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.