/* Table structure to store posts------------------------------------------------------
CREATE TABLE Bbsrow (
bbsrow_id Int (6) NOT NULL auto_increment,//posting ID number
Bbsrow_auth varchar () not NULL,//author of posts
Bbsrow_parentid Int (6),//Post ID number of the father posts, such as the first sticker is empty
Bbsrow_title varchar ($) NOT NULL,//Post title
Bbsrow_returncount Int (3),//Post number of replies, if no huitie is empty
Primary KEY (BBSROW_ID)
);
-----------------------------------------------------------------------------*/
Shows the recursive function of the son's post--------------------------------------------------
function Showchildren ($parent _id) {
Global $connect _id;
$query = "SELECT * from Bbsrow where bbsrow_parentid= '". $parent _id. "'";
$result _top=mysql_query ($query, $connect _id);
echo "
";
while ($myrow _child=mysql_fetch_row ($result _top)) {
echo "
- ";
echo $myrow _child[0];
echo $myrow _child[1];
echo $myrow _child[2];
echo $myrow _child[3];
Echo $myrow _child[4]. "";
If the number of replies is not empty, then there is a son paste, continue to show the son posted
if ($myrow _child[4]!= ") {
Showchildren ($myrow _child[0]);
}
}
echo "
";
}
//----------------------------------------------------------------------
Connect to the database and place all the initial stickers into the $mainrow array----------------------------
$connect _id=mysql_connect ("localhost", "Test", "test") or Die ("Unable to connect to database");
mysql_select_db ("BBS") or Die ("Cannot 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];
http://www.bkjia.com/PHPjc/631062.html www.bkjia.com true http://www.bkjia.com/PHPjc/631062.html techarticle */* table structure that holds posts------------------------------------------------------create table Bbsrow (bbsrow_id int (6) NOT NULL Auto_increment,//posts ID number Bbsrow_auth varchar (2 ...