Home > php教程 > php手册 > body text

PHP无限分类-PHP100代码篇

WBOY
Release: 2016-06-21 08:49:25
Original
1239 people have browsed it

 

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

//$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);

     }

 

   }

  

  

 

   



Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template