我面临的当前问题是,当我输入 url 时,我的 MySql 表没有显示:www.mydoman.com/search-results.php?town=Blackpool
-venuetbl 中的结果没有显示并且打印错误正在说明Resource id #4
<?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
}
?>