<?php
$conn = mysqli_connect($host, $user, $passwd, $dbName);
$whereClauses = array();
if (! empty($_POST['user'])) $whereClauses[] ="type='".mysqli_real_escape_string($conn,$_POST['user'])."'";
if (! empty($_POST['city'])) $whereClauses[] ="area='".mysqli_real_escape_string($conn,$_POST['city'])."'";
$where = '';
if (count($whereClauses) > 0) { $where = ' WHERE '.implode(' AND ',$whereClauses); }
$page=$_GET["page"];
if($page == "" || $page == "1"){
$page1=0;
}
else{
$page1=($page*2)-2;
}
if (! empty($_POST['order'])) {$query = "SELECT * FROM House ".$where."ORDER BY ".$_POST['order']." LIMIT $page1,2 "; }
else{
$query = "SELECT * FROM House ".$where." LIMIT $page1,2";
}
$row = mysqli_query($conn,$query);
echo "<div id='product'>";
while($data=mysqli_fetch_assoc($row)){
$houseid = $data['houseId'];
$titleid = $data['title'];
$numberid = $data['number'];
$streetid = $data['street'];
$postcodeid = $data['postcode'];
$areaid = $data['area'];
$desid = $data['description'];
$bedid = $data['bed'];
$bathroomid = $data['bathroom'];
$rateid = $data['rate'];
$typeid = $data['type'];
echo"
<div id='single'>
$query1 = "SELECT imageId,name,alt From Image Where houseId = '$houseid'";
if ( !($result = mysqli_query($conn, $query1)) ) {
die('<p>Error reading database</p></body></html>');
}
if ($result->num_rows){
$row1 = mysqli_fetch_assoc($result);
echo
'<a href="view.php?viewid='. $houseid .'">
<img src="getimg.php?id=' . $row1['imageId'] . '" width=200 height=200 alt="' . $row1['alt'] . '" title="' . $row1['name'] .'"/>
</a>';
}
echo"
</div>
</div>
";}
$query3 = "SELECT * FROM House ".$where."";
$res2 = mysqli_query($conn,$query3);
$count = $res2->num_rows;
$a=$count/2;
$a=ceil($a);
for($b=1;$b<=$a;$b++)
{
?><a href="search.php?page=<?php echo $b;?>"style="text-decoration:none"> <?php echo $b. " ";?></a><?php
}
?>
</body>
</html>
嗨,问题是页面链接不起作用,如果我点击其中任何一个并最终显示所有产品,它就会重置。 我将数据从另一个页面上的另一个表单发布到此页面。
我试过这个!isset($ _ SESSION ['first_run']))但是这并没有让我使用新的搜索条件,因为旧版本不会消失。