【类型】主程式
【版本】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);
?>