- PUBLIC"-//W3C//DTD Xhtml 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- 租房子
- 区域:全选
- //传入两个参数
- php
- include("./DBDA.class.php");//引入类文件
- $db=new DBDA();
- $sqx= "select distinct area from housedb";
- $aqx=$db->Query($sqx);
- foreach($aqx as $v)
- {
- echo"$v[0]}' />{$v[0]}";
- }
- >
- 租赁类型:全选
- php
- $szl= "select distinct renttype from housedb";
- $azl=$db->Query($szl);
- foreach($azl as $v)
- {
- echo"$v[0]}' />{$v[0]}";
- }
- >
- 房屋类型:全选
- php
- $sfw= "select distinct housetype from housedb";
- $afw=$db->Query($sfw);
- foreach($afw as $v)
- {
- echo"$v[0]}' />{$v[0]}";
- }
- >
- 关键字:
- 关键字 区域 使用面积 租金 租赁类型 房屋类型
- php
- $tj1= " 1=1 ";
- $tj2= " 1=1 ";
- $tj3= " 1=1 ";
- $tj4= " 1=1 ";
- if(!empty($_POST["qx"]) &&count($_POST["qx"])>0)
- {
- $str=implode("','",$_POST["qx"]);
- $tj1= " area in ('{$str}') ";
- }
- if(!empty($_POST["zl"]) &&count($_POST["zl"])>0)
- {
- $str=implode("','",$_POST["zl"]);
- $tj2= " renttype in ('{$str}') ";
- }
- if(!empty($_POST["fw"]) &&count($_POST["fw"])>0)
- {
- $str=implode("','",$_POST["fw"]);
- $tj3= " housetype in ('{$str}') ";
- }
- if(!empty($_POST["keywords"]))
- {
- $key=$_POST["keywords"];
- $tj4= " keyword like '%{$key}%' ";
- }
- $sql= "select * from housedb where {$tj1} and {$tj2} and {$tj3} and {$tj4}";
- echo $sql;
- $arr=$db->Query($sql);
- foreach($arr as $v)
- {
- echo"<tr>
- <td>{$v[1]}</td>
- <td>{$v[2]}</td>
- <td>{$v[3]}</td>
- <td>{$v[4]}</td>
- <td>{$v[5]}</td>
- <td>{$v[6]}</td>
- </tr>";
- }
- >
- functionxuan(qx,lei)//方法类似的尽量写一个,改变参数
- {
- varck = document.getElementsByClassName(lei);
- if(qx.checked)
- {
- for(vari=0;i)
- {
- ck[i].setAttribute("checked","checked");
- }
- }
- else
- {
- for(vari=0;i)
- {
- ck[i].removeAttribute("checked");
- }
- }
- }
来源: http://www.bubuko.com/infodetail-1960043.html