The query will traverse the table, showing that the table is the same as before, not much, say, how to write check box conditions
One, traverse the contents of the check box, list name: The others are the same traversal method
<div> area: <input type= "checkbox"/> Select all </div>
<div> <?php $sqla = "SELECT distinct area from house"; Go to the area name $a = $db->query ($sqla); while ($qy = $a->fetch_row ()) { echo "<input type= ' checkbox ' name= ' quyu[] ' value= ' {$qy [0]} ' >{$ Qy[0]} "; } ? ></div>
Second, the preparation of the conditions: write one on it, and the others are almost
<?php $db = new mysqli ("localhost", "root", "123", "Housedb"); $TJ 1 = "1=1"; Permanent establishment//area conditions if (!empty ($_post["Quyu"]) && count ($_post["Quyu"]) >0)//determine if NULL {$quyu = $_post["Quyu"]; The array is stitched into the condition of the query: code in (', ', ', ', ', ')//array concatenation string $str = Implode ("', '", $quyu);//Query condition $TJ 1 = "area in (' {$str} ') "; }
Three, JS full selection of the preparation
function Quanxuan (a) {var qx = document.getelementsbyclassname ("QX"); if (a.checked) //Determine if the value of the property is selected {for (Var i=0;i <qx.length;i++) { Qx[i].setattribute ("Checked", "checked"); Add attribute}}else{for (var i=0;i<qx.length;i++) { qx[i].removeattribute ("checked"); Remove attribute}}}
Iv. Session Retention
1.session
Characteristics:
(1) Has default expiration time, about 15 minutes
(2) stored on the server, each person saves one copy
(3) can store any type of data
Usage:
Use the session to the top of the page need to add session_start ();
Assignment $_session["UID"]= "Zhangsan";
Value $_session["UID"];
2.cookie
Characteristics
(1) stored in the client's
(2) No expiry time
(3) Only data with string types can be stored
Usage:
Assignment: Setcookie ("UID", "Lisi");
Value: $_cookie["UID"];
Multi-criteria query (check box condition)