//获取指定栏目的所有子栏目

//@param:$id(栏目ID)

function get_child_id($id){
  $arr='';
  $sql="select id from ".DB_PRE."category where cate_hide!=1 and cate_parent=".intval($id);
  $child=$GLOBALS['mysql']->fetch_asc($sql);
  if(empty($child)){
    return '';
  }else{
    foreach($child as $k=>$v){
      $arr.=",".$v['id'];
      $arr.=get_child_id($v['id']);
    }
  unset($child);
  return $arr;
  }
}

posted on 2014-01-22 10:50  坠落的数字  阅读(231)  评论(0编辑  收藏  举报