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 ';