租房子
Posted 颠覆整个世界
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了租房子相关的知识,希望对你有一定的参考价值。
<body> <form action="zu,php" method="post"> <div>区域: <input type="checkbox" onclick="CheckAll(this,\'qy\')"/>全选</div> <?php include("DBDA.class.php"); $db = new DBDA(); $sqlqy = "select distinct Area from house"; $atr = $db->Query($sqlqy,0,"housedb"); foreach($atr as $v) { echo "<input type=\'checkbox\' class=\'qy\' value=\'{$v[0]}\' name=\'qy[]\'/>{$v[0]} "; } ?> <div><br/></div> <div>租赁类型: <input type="checkbox" onclick="CheckAll(this,\'zl\')"/>全选</div> <?php $sqlzl = "select distinct RentType from house"; $atr = $db->Query($sqlzl,0,"housedb"); foreach($atr as $v) { echo "<input type=\'checkbox\' class=\'zl\' value=\'{$v[0]}\' name=\'zl[]\'/>{$v[0]} "; } ?> <div><br/></div> <div>房屋类型: <input type="checkbox" onclick="CheckAll(this,\'fw\')"/>全选</div> <?php $sqlfw = "select distinct HouseType from house"; $atr = $db->Query($sqlfw,0,"housedb"); foreach($atr as $v) { echo "<input type=\'checkbox\' class=\'fw\' value=\'{$v[0]}\' name=\'fw[]\'/>{$v[0]} "; } ?> <div><br/></div> <div>关键字:<input type="text" name="key" /></div> <input type="submit" value="搜索"/> </form>
多条件查询,数据以表格的形式显示;
<table width="100%" cellpadding="0" cellspacing="0" border="1"> <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"])) { $str = $_POST["qy"]; $attr = implode("\',\'",$str); $tj1 = "Area in (\'{$attr}\')"; } if(!empty($_POST["zl"])) { $str = $_POST["zl"]; $attr = implode("\',\'",$str); $tj2 = "RentType in (\'{$attr}\')"; } if(!empty($_POST["fw"])) { $str = $_POST["fw"]; $attr = implode("\',\'",$str); $tj3 = "Housetype in (\'{$attr}\')"; } if(!empty($_POST["key"])) { $key = $_POST["key"]; $tj4 = "keyword like \'%{$_POST[\'key\']}%\'"; } $tj =" where {$tj1} and {$tj2} and {$tj3} and {$tj4}"; $sql = "select * from house".$tj; $result = $db->Query($sql,0,"housedb"); foreach($result 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>
以上是关于租房子的主要内容,如果未能解决你的问题,请参考以下文章
创建广告时出现代码 200 和子代码 1487194 的 Facebook 错误背后的原因是啥?
在 SpriteKit 中出现错误。 - 线程 1:EXC_BREAKPOINT(代码=1,子代码=0x1007351fc)
Facebook OAuthException代码190子代码490 - 用户注册了阻塞的登录检查点
斯威夫特 3 - 'EXC_BAD_INSTRUCTION(代码 = EXC_1386_INVOP,子代码 = 0x0)' 错误