加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程 > 正文

php出租房数据管理及搜索页面

发布时间:2021-01-18 06:48:50 所属栏目:编程 来源:网络整理
导读:php数据会见例子:租房信息打点,详细内容如下 1.数据库建表 2. zufangzi.php div class="jb51code" pre class="brush:xhtml;" 租屋子 form action="zufangzi.php" method="post" 地区: 全选 $sqy = "select distinct area from house";//写SQL语句,并去重

php数据会见例子:租房信息打点,详细内容如下

php出租房数据打点及搜刮页面

php出租房数据打点及搜刮页面

1.数据库建表

2. zufangzi.php

<div class="jb51code">
<pre class="brush:xhtml;">

租屋子

<form action="zufangzi.php" method="post">

地区:全选 $sqy = "select distinct area from house";//写SQL语句,并去重
$aqy = $db->query($sqy);
foreach($aqy as $v)
{
echo "{$v[0]}";
}
?>


租赁范例:全选 query($szl); foreach($azl as $v) { echo "{$v[0]}"; } ?>
衡宇范例:全选 query($sfw); foreach($afw as $v) { echo "{$v[0]}"; } ?>
要害字:

<table width="100%" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>要害字</td>
<td>地区</td>
<td>构筑面积</td>
<td>租金</td>
<td>租赁范例</td>
<td>衡宇范例</td>
</tr>
<?php

$tj1 = " 1=1 ";
$tj2 = " 1=1 ";
$tj3 = " 1=1 ";
$tj4 = " 1=1 ";

if(!empty($_POST["qy"]))
{
$aqy = $_POST["qy"];
$sqy = implode("','",$aqy);

$tj1 = " area in ('{$sqy}') ";

}

if(!empty($_POST["zl"]))
{
$azl = $_POST["zl"];
$szl = implode("',$azl);

$tj2 = " renttype in ('{$szl}') ";

}

if(!empty($_POST["fw"]))
{
$afw = $_POST["fw"];
$sfw = implode("',$afw);

$tj3 = " housetype in ('{$sfw}') ";

}

if(!empty($_POST["key"]))
{
$k = $_POST["key"];
$tj4 = " keyword like '%{$k}%' ";
}

$sql = "select * from house 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>";
}
?>
</table>

所引用的封装类

host,$this->uid,$this->pwd,$this->dbname);
$result = $db->query($sql);

if($type)
{
  //假如是查询,表现数据
  return $result->fetch_all();
}
else
{
  //假如是增编削,返回true可能false
  return $result;
}

}
}

泛起页面

以上就是本文的所有内容,但愿对各人的进修有所辅佐,也但愿各人多多支持编程之家。

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读