【類型】主程式
【版本】3.01
請教各位先進~
最近要做論壇的home首頁(類似
http://08.plu...com/板塊顯示)
想要動態顯示分類板塊(category)與子板塊(forum)
因為板塊資訊存在phpwind中的pw_forums資料庫中~
我用dw作首頁~程式碼如下~但是他只會重複顯示出第一筆分類的的category與forum
接下來都只有category版塊~~
如:
版務區
->公告版
->新首版
....
軟體區
->
硬體區
->
只有版務區會顯示子板塊~其他都是空的~我不太知道要怎麼寫才能正確?
請高手解惑~謝謝
程式碼
<?php require_once('Connections/index.php'); ?>
<?php
mysql_select_db($database_index, $index);
$query_forum = "SELECT * FROM pw_forums WHERE fup = 0 ORDER BY vieworder ASC";
$forum = mysql_query($query_forum, $index) or die(mysql_error());
$row_forum = mysql_fetch_assoc($forum);
$totalRows_forum = mysql_num_rows($forum);
mysql_select_db($database_index, $index);
$query_subname = "SELECT * FROM pw_forums WHERE fup LIKE '%$row_forum[fid]%' ORDER BY vieworder ASC";
$subname = mysql_query($query_subname, $index) or die(mysql_error());
$row_subname = mysql_fetch_assoc($subname);
$totalRows_subname = mysql_num_rows($subname);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xht...l.dtd">
<html xmlns="http://www.w3.org/199...uot;>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<title>無標題文件</title>
<style type="text/css">
<!--
.style4 {color: #009966}
-->
</style>
</head>
<body>
<?php do { ?>
<p><?php echo $row_forum['name']; ?></p>
<?php do { ?>-<?php echo $row_subname['name']; ?><br>
<?php } while ($row_subname = mysql_fetch_assoc($subname)); ?>
<?php } while ($row_forum = mysql_fetch_assoc($forum)); ?><p></p>
<p> </p>
</body>
</html>
<?php
mysql_free_result($forum);
mysql_free_result($subname);
?>