爲什麼不是我的while循環獲取mysql數據庫條目並呈現它們像演示?謝謝 :)。我的while循環不抓取MySQL數據庫條目
<?php $djs_all_db = mysql_query("SELECT * FROM djs")
or die(mysql_error());
$djs_all_num = mysql_num_rows($djs_all_db);
while($djs_all = mysql_fetch_array($djs_all_db)) {
if ($djs_all_num % "2") {
echo "<div class=\"row\">
<div class=\"column column-2\">
<img src=\"images/about/" . $djs['username'] . "-profile.png\" alt=\"Profile\" class=\"profile-image\"/>
<p class=\"float-left\"><strong>" . $djs['realname'] . "</strong></p>
<p class=\"float-right\"><a href=\"#\" title=\"\">" . $djs['position'] . "</a></p>
<div class=\"clear\"></div>
<p>" . $djs['biography'] . "</p>
</div>";
} else {
echo "<div class=\"column column-3\">
<img src=\"images/about/" . $djs['username'] . "-profile.png\" alt=\"Profile\" class=\"profile-image\"/>
<p class=\"float-left\"><strong>" . $djs['realname'] . "</strong></p>
<p class=\"float-right\"><a href=\"#\" title=\"\">" . $djs['position'] . "</a></p>
<div class=\"clear\"></div>
<p>" . $djs['biography'] . "</p>
</div></div>";
} }?>
任何你如果有什麼錯誤? – Sarfraz 2010-06-21 13:33:16
不幸的是,沒有錯誤。 – Sam 2010-06-21 13:37:40
你確定你的意思是'if($ djs_all_num%「2」)'而不是'if($ djs_all_num%2 == 0)'? '$ djs'應該是'$ djs_all' – 2010-06-21 13:38:02