我写的一个用PHP+MYSQL轻松实现论坛里的分级+分页显示的例程!(很详细的哦!虽然效率不是最佳,却非...
<?
/*存放贴子的表结构------------------------------------------------------
create table bbsrow(
bbsrow_id int(6) not null auto_increment, //贴子ID号
bbsrow_auth varchar(20) not null, //贴子作者
bbsrow_parentid int(6), //贴子的父亲贴子ID号,如为首发贴则为空
bbsrow_title varchar(200) not null, //贴子标题
bbsrow_returncount int(3), //贴子的回复贴数,如果没有回贴则为空
primary key (bbsrow_id)
);
-----------------------------------------------------------------------------*/
//显示儿子贴的递归函数--------------------------------------------------
function showchildren($parent_id){
global $connect_id;
$query="select * from bbsrow where bbsrow_parentid='" . $parent_id . "'";
$result_top=mysql_query($query,$connect_id);
echo "<ul>\n";
while($myrow_child=mysql_fetch_row($result_top)){
echo "<li>";
echo $myrow_child[0];
echo $myrow_child[1];
echo $myrow_child[2];
&nbs
| 对此文章发表了评论 |
