时间:2021-07-01 10:21:17 帮助过:13人阅读
$My_rs = $my_conn->mysql_query('select * from table where pid = 0');
$class_rs = array();
$Do_While_Static=mysql_num_rows($My_rs)?true:false;
if($Do_While_Static) $Prs=array($My_rs);
while($Do_While_Static){
$My_rs=end($Prs);
if($rs=mysql_fetch_array($My_rs)){
$class_rs[]=$rs;
$My_Prs = $my_conn->mysql_query('select * from table where pid = '.$rs['id']);
$Temp_Static=mysql_num_rows($My_Prs)?true:false;
if($Temp_Static) $Prs[]=$My_Prs;
}else{
array_pop($Prs);
if(count($Prs)==0){
$Do_While_Static=false;
break;
}
}
}
foreach($class_rs as $rs){
$T_Str=str_pad('',$rs['level'],"-");
echo $T_Str.$rs['name'];
}