0
您好即時通訊新下訓練MySQL和PHP哪裏我錯了MySQL和PHP顯示錯誤
中AD01和AD03出現我的問題,請告訴我,他們是回聲刊登廣告,但AD02回聲正常
<?php require_once('Connections/localhost.php'); ?>
<?php
mysql_select_db($database_localhost, $localhost);
$query_advtDisplay = "SELECT * FROM advt";
$advtDisplay = mysql_query($query_advtDisplay, $localhost) or die(mysql_error());
$row_advtDisplay = mysql_fetch_assoc($advtDisplay);
$totalRows_advtDisplay = mysql_num_rows($advtDisplay);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Download Links</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="wrapper">
<div class="ad01">
<?php if ($row_advtDisplay['advt-no']=='ad01')
{
echo $row_advtDisplay['advt-content'];
}
else{ echo "Advertise Here";}
?>
</div>
<div class="middlebox">
<div class="ad02">
<?php if ($row_advtDisplay['advt-no']=='ad02')
{
echo $row_advtDisplay['advt-content'];
}
else{ echo "Advertise Here";}
?>
</div>
<div class="linkbox">
<p>Download Links</p>
<ul>
<li><a href="#">Link 01</a></li>
<li><a href="#">Link 02</a></li>
<li><a href="#">Link 03</a></li>
<li><a href="#">Link 04</a></li>
<li><a href="#">Link 05</a></li>
</ul>
<ul>
<li><a href="#">Link 06</a></li>
<li><a href="#">Link 07</a></li>
<li><a href="#">Link 08</a></li>
<li><a href="#">Link 09</a></li>
<li><a href="#">Link 10</a></li>
</ul>
<ul>
<li><a href="#" target="_blank">Link 11</a></li>
<li><a href="#" target="_blank">Link 12</a></li>
<li><a href="#" target="_blank">Link 13</a></li>
<li><a href="#" target="_blank">Link 14</a></li>
<li><a href="#" target="_blank">Link 15</a></li>
</ul>
</div>
<div class="passwordbox">
<p>RAR Password</p>
</div>
</div>
<div class="ad03"><?php if ($row_advtDisplay['advt-no']=='ad03')
{
echo $row_advtDisplay['advt-content'];
}
else{ echo "Advertise Here";}
?></div>
<div class="clear"></div>
</div>
</body>
</html>
<?php
mysql_free_result($advtDisplay);
?>
只有正確AD02不顯示AD01和AD03 與表只編碼問題對不起,沒有問題的英語不好
我不得不假設,那麼...... $ row_advtDisplay ['advt-no'] ='ad02''因此'ad01'和'ad03'命中'else'語句。 – 2014-10-10 23:15:15
您只提取結果集中的第一行。請閱讀關於循環拋出一個結果集...在這裏例如:http://php.net/manual/en/mysqli-result.fetch-assoc.php – 2014-10-10 23:15:49
等等...什麼是PHP錯誤? – 2014-10-10 23:32:47