需要查询的表格
代码:
无标题文档require "Wang.class.php"; //调用类
$db= new Wang();
$keyword="";
$tj1 = " 1=1 ";
$tj2 = " 1=1 ";
$tj3 = " 1=1 ";
$tj4 = " 1=1 ";
if(!empty($_POST["area"]))
{
$area=$_POST["area"];
$str1 = implode("','",$area);
$tj1 = " area in ('{$str1}') ";
}
if(!empty($_POST["renttype"]))
{
$renttype =$_POST["renttype"];
$str2 = implode("','",$renttype);
$tj2 = " renttype in ('{$str2}') ";
}
if(!empty($_POST["housetype"]))
{
$housetype =$_POST["housetype"];
$str3 = implode("','",$housetype);
$tj3 = " housetype in ('{$str3}') ";
}
if(!empty($_POST["keyword"]))
{
$keyword=$_POST["keyword"];
$tj4 = " keyword like '%{$keyword}%' ";
}
?>
区 域:全选
$sql = "select distinct area from house";
$arr = $db->query($sql);
foreach($arr as $v)
{
echo "
{$v[0]}";}
?>
租赁类型: 全选
$sqlr = "select distinct renttype from house";
$arr1 = $db->query($sqlr);
foreach($arr1 as $r)
{
echo "
{$r[0]}";}
?>
房屋类型:全选
$sqlh = "select distinct housetype from house";
$arr2 = $db->query($sqlh);
foreach($arr2 as $h)
{
echo "
{$h[0]}";}
?>
关 键 字:
关键字 | 区域 | 面积 | 租金(每月) | 租赁类型 | 房屋类型 |
$tj =" {$tj1} and {$tj2} and {$tj3} and {$tj4} ";
$sqly = "select * from house where ".$tj;
$arry = $db->query($sqly,1);
foreach($arry as $y)
{
$str = str_replace($keyword,"{$keyword}",$y[1]);
echo "
{$str}{$y[2]}{$y[3]}{$y[4]}{$y[5]}{$y[6]}";}
?>
function quanxuan(a,qy)
{
var ck = document.getElementsByClassName(qy);
if(a.checked)
{
for(var i=0;i
{
ck[i].setAttribute("checked","checked");
}
}
else
{
for(var i=0;i
{
ck[i].removeAttribute("checked");
}
}
}