|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
<?php /*存放帖子的表结构 CREATE TABLE announce ( announce_id int(11) NOT NULL auto_increment, board_id smallint(6) NOT NULL, title varchar(100) NOT NULL, content tinytext, add_time datetime DEFAULT \\'0000-00-00 00:00:00\\' NOT NULL, auth_name varchar(20) NOT NULL, auth_mail varchar(40), hit_count smallint(6) NOT NULL, bytes mediumint(9) NOT NULL, parent_id tinyint(4) NOT NULL, auth_ip varchar(15) NOT NULL, top_id int(11) NOT NULL, return_count tinyint(4) NOT NULL, face char(3) NOT NULL, PRIMARY KEY (announce_id), KEY board_id (board_id), KEY top_id (top_id) ); */ function show_announce($id,$self_id){ global $dbconnect; global $board_id; $query="select * from announce where announce_id=\\'$id\\'"; $result=mysql_query($query,$dbconnect); $myrow=mysql_fetch_array($result); mysql_free_result($result); echo "<li>/n"; echo "<img src=\\'images/mood".$myrow[face].".gif\\'> "; if($self_id!=$id) echo "<a href=\\'show.php3?board_id=$board_id&announce_id=$myrow[announce_id]&top_id=$myrow[top_id]\\'>"; echo $myrow[title]; if($self_id!=$id) echo "</a>"; echo " - <strong>【".$myrow[auth_name]."】</strong> ".$myrow[add_time]." <font color=darkblue>[id:$myrow][announce_id] 点击:$myrow[hit_count]]</font> ($myrow[bytes] Bytes) <font color=red>($myrow[return_count])</font>/n"; $query="select announce_id from announce where parent_id=\\'$id\\' order by announce_id desc"; $result=mysql_query($query,$dbconnect); echo "<ul>/n"; while($myrow=mysql_fetch_array($result)){ show_announce($myrow[announce_id],$self_id); } echo "</ul>/n"; mysql_free_result($result); echo "</li>"; } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>论坛内容</title> <link rel="stylesheet" type="text/css" href="common.css"> </head> <body> <?php //此处需要连接数据库 //可以根据需要加入分页 $query="select announce_id from announce where top_id=\\'0\\' order by announce_id desc "; $result_top=mysql_query($query,$dbconnect); echo "<ul>/n"; while($myrow_top=mysql_fetch_array($result_top)){ show_announce($myrow_top[announce_id],0); } echo "</ul>/n"; mysql_free_result($result_top); ?> </body> </html> 返回类别: 教程 上一教程: 基于什么样的理由 PHP 比其它 CGI 下一教程: PHP如何读取COOKIES 您可以阅读与"一个在PHP中利用递归实现论坛分级显示的例子(为了简朴起见,我将分页显示部分去掉了)"相关的教程: · 我写的一个用PHP+MYSQL轻松实现论坛里的分级+分页显示的例程!(很具体的哦!虽然效率不是最佳,却非... · 给大家一个点子:利用MySQL的一个特性实现MySQL查询结果的分页显示 · 例子:用PHP3实现MySQL数据的分页显示 · PHP+MySQL下分页显示的实现 · 用PHP实现ODBC数据分页显示一例 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |