PHP infinite classification (non-recursive)_PHP tutorial

WBOY
Release: 2016-07-13 17:49:00
Original
918 people have browsed it

/**
* Unlimited categories
* 2011/8/24
* kcj
**/ 
include "../conn/conn.php"; 
$flpid=$_POST['flpid']; 
$fltitle=$_POST['title']; 
$fldes=$_POST['des']; 
if(isset($_POST['action'])!=''&&$_POST['action']="add"){               // 无限分类(非递归),用路径来判断分类归属(flid=flpid)  
        $sql2="select flpath from fenlei where flid=".$flpid; 
        $rst2=mysql_query($sql2); 
        $row=mysql_fetch_array($rst2,MYSQL_ASSOC); 
        $flpath=$row['flpath']; 
    $sql="insert into fenlei (flpid,fltitle,fldes,flpath) value('".$flpid."','".$fltitle."','".$fldes."','".($flpath.'-'.$flpid)."')"; 
    mysql_query($sql); 
     

 
?> 
 
 
 
 
     
         
        无标题文档 
         
         
         
         
         
         
     
     
       

 
              后台管理->添加分类 
             
           
 
               
     
                       
  •  
    & Lt; span class = "color_width" & gt; superior column & lt;/span & gt;
                                                                                                                                                                       
                                                                                                              $sql="SELECT*FROM fenlei where flpid=0"; //This block is just in the drop-down list, showing the three-level classification (you can display more, just cycle it out!)
    $rs=mysql_query($sql);
    While ($row=mysql_fetch_array($rs)) { var_dump($row);
    echo "";


            $sql="select*from fenlei where flpid=$row[flid]";
              $rs_son=mysql_query($sql);
    ​​​​while($row_son=mysql_fetch_array($rs_son)){
    echo "";
                                                                                   $sql="select*from fenlei where flpid=$row_son[flid]";
                    $rs_son_one=mysql_query($sql);
                  while($row_son_one=mysql_fetch_array($rs_son_one)){
    echo "";
                                                                                                                                               }  

    }  
    ?>
                                                                                                                                                                                                                                                                 

  • & Lt; span class = "color_width" & gt; column name & lt; span class = "red_font" & gt;*& lt;/span & gt; & lt;/span & gt;
                               
                                                                                                                                                                                                                                                                                                                                  ​                                                                                                                                                                                                                                      Column Description

                       
  •  
                         
     
                       
  •  
                                
                             
                               
                             
                       
  •  
                   
  
           
 
                        
       
 
     
 

摘自 chaojie2009的专栏

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478365.htmlTechArticle? /*** Unlimited categories * 2011/8/24 * kcj **/ include ../conn/conn.php; $flpid=$_POST[flpid]; $fltitle=$_POST[title]; $fldes=$_POST[des]; if(isset($_POST[action])!=$_POST[action]=add)...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template