<?
/* Table Structure for storing posts ------------------------------------------------------
Create table bbsrow (
Bbsrow_id int (6) not null auto_increment, // ID of the subscriber
Bbsrow_auth varchar (20) not null, // post author
Bbsrow_parentid int (6), // ID of the parent ID of the post, which is blank if the first post is sent
Bbsrow_title varchar (200) not null, // post subtitle
Bbsrow_returncount int (3), // number of replies to the post. It is null if no replies are posted.
Primary key (bbsrow_id)
);
-----------------------------------------------------------------------------*/
// Display the recursive function posted by the son --------------------------------------------------
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> ";
While ($ myrow_child = mysql_fetch_row ($ result_top )){
Echo "<li> ";
Echo $ myrow_child [0];
Echo $ myrow_child [1];
Echo $ myrow_child [2];
Echo $ myrow_child [3];
Echo $ myrow_child [4]. "";
// If the number of reply posts is not blank, it indicates that there is a son post and the son post will continue to be displayed.
If ($ myrow_child [4]! = ''){
Showchildren ($ myrow_child [0]);
}
}
Echo "</ul> ";
}
//----------------------------------------------------------------------
// Connect to the database and put all the first posts in the $ mainrow array ----------------------------
$ Connect_id = mysql_connect ("localhost", "test", "test") or die ("unable to connect to Database ");
Mysql_select_db ("bbs") or die ("unable to select database ");
$ Query = "select * from bbsrow where bbsrow_parentid = ''";
$ Result = mysql_query ($ query, $ connect_id );
$ I = 0;
While ($ myrow = mysql_fetch_row ($ result )){
$ Mainrow [$ I] [0] = $ myrow [0];
$ Mainrow [$ I] [1] = $ myrow [1];
$ Mainrow [$ I] [2] = $ myrow [2];
$ Mainrow [$ I] [3] = $ myrow [3];
$ Mainrow [$ I] [4] = $ myrow [4];