选择显示字体大小

一个在php中利用递归实现论坛分级显示的例子


<?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(&#36;id,&#36;self_id){
global &#36;dbconnect;
global &#36;board_id;
&#36;query=&quot;select * from announce where announce_id='&#36;id'&quot;;
&#36;result=mysql_query(&#36;query,&#36;dbconnect);
&#36;myrow=mysql_fetch_array(&#36;result);
mysql_free_result(&#36;result);
echo &quot;<li>\n&quot;;
echo &quot;<img src='images/mood&quot;.&#36;myrow[face].&quot;.gif'> &quot;;
if(&#36;self_id!=&#36;id)
echo &quot;<a href='show.php3?board_id=&#36;board_id&announce_id=&#36;myrow[announce_id]&top_id=&#36;myrow[top_id]'>&quot;;
echo &#36;myrow[title];
if(&#36;self_id!=&#36;id)
echo &quot;</a>&quot;;
echo &quot; - <strong>【&quot;.&#36;myrow[auth_name].&quot;】</strong> &quot;.&#36;myrow[add_time].&quot; <font color=darkblue>[id:&#36;myrow][announce_id] 点击:&#36;myrow[hit_count]]</font> (&#36;myrow[bytes] bytes) <font color=red>(&#36;myrow[return_count])</font>\n&quot;;
&#36;query=&quot;select announce_id from announce where parent_id='&#36;id' order by announce_id desc&quot;;
&#36;result=mysql_query(&#36;query,&#36;dbconnect);
echo &quot;<ul>\n&quot;;
while(&#36;myrow=mysql_fetch_array(&#36;result)){
show_announce(&#36;myrow[announce_id],&#36;self_id);
}
echo &quot;</ul>\n&quot;;
mysql_free_result(&#36;result);
echo &quot;</li>&quot;;
}
?>

<html>
<head>
<meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=gb2312&quot;>
<title>论坛内容</title>
<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;common.css&quot;>
</head>

<body>
<?php
//此处需要连接数据库
//可以根据需要加入分页
&#36;query=&quot;select announce_id from announce where top_id='0' order by announce_id desc &quot;;
&#36;result_top=mysql_query(&#36;query,&#36;dbconnect);
echo &quot;<ul>\n&quot;;
while(&#36;myrow_top=mysql_fetch_array(&#36;result_top)){
show_announce(&#36;myrow_top[announce_id],0);
}
echo &quot;</ul>\n&quot;;
mysql_free_result(&#36;result_top);
?>
</body>
</html>

  


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons