PHP Statement solution for dynamic multi-logical relation multi-conditional query

Source: Internet
Author: User
The PHP Statement of dynamic Multi-logical relation multi-conditional query
Hello, Heroes! I am making a multi-conditional query system with multiple logical relationships, with and, or, not three, with a drop-down list for the user to choose. I added two buttons on the page, click the Add button, will automatically add a row to select the query criteria (this is implemented with JS), there are three: the logical relationship of the dropdown table (name is logic), search for items (such as: School number, name, hometown, etc., name is Searchitem), The input text box (name keyword) gives the user a keyword. Click the Delete button and the criteria row you just added will be deleted. My question is, how are the values of these dynamically generated drop-down lists and text boxes passed to the php file? SQL query statements are then generated based on the logical relationships that the user chooses (there may be multiple), search terms, and keywords. Thank you very much!



------Solution--------------------
This logical relationship is very complicated and difficult for me.
The code I gave is only a grammatical reference. Mind your own arrangement
PHP Code
$sql = "SELECT * from Student"; if (! empty ($_get['))//If the user fills out the number option    $where. = ' study Number ' = {$_get[' study number '} '; if (! Empty ($_get[' name ')) {      //If yes or relationship    $where. =  ( $_get[' and '] = = ' 0 '))? ' OR ': ' and ';    
  • 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.