About the query, you can write directly on the main page to query
First, start by creating a form
<form method="Post"Action="crud.php"> <table> <tr><!--<td>--><!--number <input type="Text"Name="Id">--><!--</td>--> <td> name <input type="Text"Name="Name"> </td> <td> Sex <Select Name="Sex">
<OptionValue="> Please select </.Option> <option value="1"> Male </option> <option value="0"> Women </option> </select> </td> <td> Birth date <input type="Text"Name="birth_start ">--<input type= "text" Name=" birth_end "> </td> <td> class <input Type= "text "Name=" class "> </td> <td> <input type=" submit "Value=" check "> </td> </tr> </table></ Form>
2. Enquiry
if (!Empty ($_post)) {//$id = $_post[' id ']; $name = $_post[‘Name‘]; $sex = $_post[‘Sex‘]; $birth _start= $_post[‘Birth_start‘]; $birth _end = $_post[‘Birth_end‘]; $class = $_post[‘Class‘];
1//if (!empty ($name)) {//$sql. = "and name like '%{$name}% '";//}
2//$sql. =!empty ($id)? "and Sno like '%{$id}% '": "";$sql. =!empty ($name)?"and Sname like '%{$name}% '" :""; $sql. = ($sex! = "and Ssex = ' {$sex} ' ": Span style= "COLOR: #800000" "" "; if (!empty ($birth _start) &&! Empty ($birth _end)) {$sql. = "and sbirthday > ' {$birth _ Start} ' and Sbirthday < ' {$birth _end} ' ": " "; $data = $db->query ($sql)->fetch_all ();?
There are two ways to do this.
Above the ID column hidden, can write not write
Test it:
1. Open the homepage
2, check all 95033 classes
3. Click to find a check
4, success, if not rest assured can write a few conditions, as follows
Check it out.
5. Success-^
PHP Connection Database Additions and deletions----multi-criteria Query