D Multi-Criteria query
BODY><BR/><form action="duotiaojian.php"Method="Post"><div>Name:<input type="text"Name="XM"/>Nationality Code:<input type="text"Name="MZ"/><input type="Submit"Value="Enquiry"/></DIV></FORM><BR/><table width="100%"Border="1"cellpadding="0"cellspacing="0"> <tr> <td> code </td> <td> name </td> <td> sex </td> < ;td> nationalities </td> <td> Birthdays </td> <td> actions </td> </tr> <?PHP//first determine if there is a commit value$XXM =""; $TJ="1=1"; $TJ 2="1=1"; if(!empty ($_post["XM"]) && $_post["XM"]!="") {$XXM= $_post["XM"]; $TJ="name like '%{$xxm}% '"; } if(!empty ($_post["MZ"]) && $_post["MZ"]!="") {$mz= $_post["MZ"]; $TJ 2="nation= ' {$mz} '"; } //Connecting Objects$db =NewMysqli ("localhost","Root","123","MyDB"); //Write SQL statements$sql ="SELECT * FROM info where". $tj." and". $TJ 2; Echo $sql; //Execute SQL statement$result = $dbquery ($sql); //Read Data$attr = $resultFetch_all (); foreach($attr as$v) {echo"<tr>"; $sex= $v [2]?"male":"female"; //Query name family name based on name Family Code$name = Nationname ($v [3]); //Replace keyword$newname = Str_replace ($XXM,"<mark>{$xxm}</mark>", $v [1]); Echo"<td>{$v [0]}</td><td>{$newname}</td><td>{$sex}</td><td>{$name} </td><td>{$v [4]}</td><td><a href= ' shanchu.php?c={$v [0]} ' onclick=\ ' return confirm (' Are you sure you deleted it? ') \ ' > Delete </a><a href= ' xiugai.php?c={$v [0]} ' > Modify </a></td>"; /*foreach ($v as $v 1) {echo "<td>{$v 1}</td>"; }*/Echo"</tr>"; } //give a national code, return the name of the Nationfunction Nationname ($code) {//Connecting Objects$db =NewMysqli ("localhost","Root","123","MyDB"); //Write SQL statements$sql ="select name from Nation where code= ' {$code} '"; //Execute SQL statement$result = $dbquery ($sql); $attr= $resultFetch_row (); return$attr [0]; } ?> </table><a href="add.php"><input type="Button"Value="Add Data"/></a></body>Php->msql Multi-Criteria Query