The author has 2 posts.
Font size: Small - 100% (Default)▼  Content converter: No conversion▼
 
Clicks Replies
1345 1
php遍历子孙节点真复杂啊!!!
产品的注销
初入江湖 七级
Reply
Floor 1 Posted at: 12/20/10 13:20
晕
产品的注销
初入江湖 七级
Reply
Floor 2 Posted at: 12/20/10 13:21

所以我把代码备份一下:

<?php

# 获取当前节点下的全部子孙节点
  $catalog_grandson_nodes=array();
  $cc=array($catalog_baseid);
  for ($jibie=$catalog_gread+1;true;$jibie++){
   $ki=sExplode(',',$cc);
   $sql="select 编号,所属父类 from 贴吧分类 where 级别=".$jibie." and 所属父类 in (".$ki.")";
   $rs=db_query($sql);
   if (db_num($rs)<1) break; # 若已到了分支末端
   $cc=array();
   while ($row=db_eof($rs)){
    $catalog_grandson_nodes[count($catalog_grandson_nodes)]=$row[0];
    $cc[count($cc)]=$row[0];
   }
  }
  $catalog_grandson_nodes_string=sExplode(",",$catalog_grandson_nodes);
  if ($catalog_grandson_nodes_string=="") $catalog_grandson_nodes_string=$catalog_baseid;

?>

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
(Shortcut key: Ctrl+Enter)
Post Information
Clicks: 1345 Replies: 1
Author: 产品的注销
Last reply: 产品的注销
Last reply time: 12/20/10 13:21
Good area: 代码备份区
Bar Hot Posts
Bar Good Posts
Announcements