正試圖爲我的作業創建一個小型網站,並且卡在一個頁面中。實際上,我的代碼不工作,因爲沒有顯示任何內容,也沒有顯示錯誤。任何幫助,將不勝感激。在此先感謝..數據未從數據庫中顯示
<?php
include ("masterzone/php/mysqli.php");
if ($stmt = $db->prepare("SELECT tbl_name FROM listing_title where listing_title_ID=?")) {
$tpe = $_GET['type'];
$stmt->bind_param("i", $tpe);
$stmt->execute();
$stmt->bind_result($tbl_name);
$stmt->fetch();
if ($stmt1 = $db->prepare("SELECT Name,Address,Phone,Email,Location,Time,Website,Photo1,Date_Published,Rating FROM $tbl_name where categories_ID=?")) {
$cat1 = $_GET['cat'];
$stmt1->bind_param("i", $cat1);
$stmt1->execute();
$stmt1->bind_result($Name, $Address, $Phone, $Email, $Location, $Time, $Website, $Photo1, $Date_Published, $Rating);
$stmt1->fetch();
?>
<div id="loop_listing_taxonomy" class="list" >
<div class="post listing-11323 ">
<img src="images/<?php echo $Photo1; ?>" alt="" title="" />
<div class="entry">
<!--start post type title -->
<div class="listing-title">
<h2 itemprop="name" class="entry-title"><?php echo $Name; ?></h2>
<div class="listing_rating">
<div class="directory_rating_row"><span class="single_rating">
<?php
for ($x = 1; $x <= $Rating; $x++) {
echo '<img src="images/rating-on.png" alt="" />';
}
?>
</span></div>
</div>
<p class="phone"><?php echo $Phone; ?></p><p class="address"><?php echo $Address; echo $Location; ?></p><p class="time"><?php echo $Time; ?></p>
</div>
</div>
</div>
</div>
<?php
$stmt1->close();
}
$stmt->close();
}
?>
您需要提供更多信息。開始檢查你的錯誤日誌... –
檢查你的connexion和Mysql錯誤日誌或Apache ... – Portekoi
添加echo'workin'在包含之前,將include更改爲require_once,創建臨時值並存儲查詢結果,以及var_dump它。基本上,嘗試隔離導致問題 – Dimitri