Home  >  Article  >  php教程  >  PHP无限分类-PHP100代码篇

PHP无限分类-PHP100代码篇

WBOY
WBOYOriginal
2016-06-21 08:49:251239browse

 

//无限分类,从子类找所有父类

//$id 子类ID

 function php100_xd($id){

   $sql="select * from fl where id='$id'";

   $q=mysql_query($sql);

   $rs=mysql_fetch_array($q);

   $rs['fid']==0 ? "" : fl($rs['fid']);

   echo $rs['name']."-";

   }

   

//读取所有父类下面的子类

//$f顶级分类从什么开始,$s样式

 function php100_dx($f=0,$s=""){

   $sql="select * from fl where fid=$f";

   $q=mysql_query($sql);

   $s=$s."-";

   while($rs=mysql_fetch_array($q)){

     echo "
$s".$rs['name'];

  flt($rs['id'],$s);

     }

 

   }

  

  

 

   



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn