我面临的当前问题是,当我输入网址时,我的MySql表格未显示:www.mydoman.com/search-results.php?town=Blackpool
- venuetbl中的结果未显示且打印错误表明Resource id #4
< / p>
<?php
session_start();
include('dbconnect.php');
if(isset($_GET['town'])) {
$town = $_GET['town'];
mysql_connect("$host", "$username", "$passwd")or die("cannot connect");
mysql_select_db("$db")or die("cannot select DB");
$res=mysql_query("SELECT * from venuetbl where town = '$town'") or die("error");
}
?>
<?php while($row = mysql_fetch_array($res)) { ?>
<div class="search-results">
<div class="result">
<img src="images/<? echo $rows['imageurl']; ?>.jpg" alt="" width="150" height="100" />
<h2><? echo $rows['name']; ?></h2>
<p><? echo $rows['description']; ?></p>
<a class="button" href="http://www.mydomain.co.uk/result.php?id=<? echo $rows['venueid']; ?>">View More</a>
<a class="button green" href="#">Add To My Venues</a>
</div><!--END Result-->
</div><!--END Search Results-->
<?php
}
?>
答案 0 :(得分:0)
您正在尝试回显$ rows ['SOME_KEY']而不是$ row ['SOME_KEY']