search
HomePHP LibrariesOther librariesPHP unlimited classification method class
PHP unlimited classification method class
<?PHP
header("Content-type: text/html; charset=utf-8");
 
$link = mysql_connect('localhost','root','eric') or die(mysql_error());
mysql_select_db('sortclass',$link);
 
class SortClass{
  var $data = array();
  var $child = array(-1=>array());
  var $layer = array(-1=>-1);
  var $parent = array();
  var $link;
  var $table;
  function SortClass($link, $table){
    $this->setNode(0, -1, '顶极节点');
    $this->link = $link;
    $this->table = $table;
    $node = array();
    $results = mysql_query('select * from '.$this->table.'',$this->link);
    while($node = mysql_fetch_assoc($results)){
      $this->setNode($node['cid'],$node['pid'],$node['cname']);
    }
  }

This is an implementation library for PHP infinite splitting, with two methods: recursive and non-recursive. Friends who need it can download it and use it.


Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

PHP unlimited classification (tree class)_PHP tutorialPHP unlimited classification (tree class)_PHP tutorial

21Jul2016

PHP unlimited classification (tree class). Copy the code as follows: ?php //Simulate PHP unlimited classification query results return array( array( 'id'=1, 'pid'=0, 'name'='Homepage' ), array( 'id'=2, ' pid'=0, 'name'='News' ), ​​array( 'id'=

PHP unlimited classification father and son tracing methodPHP unlimited classification father and son tracing method

25Jul2016

PHP unlimited classification father and son tracing method

Method to realize unlimited classification in PHP+MysqlMethod to realize unlimited classification in PHP+Mysql

15Aug2020

This article mainly introduces two methods to achieve unlimited classification in PHP+Mysql, and compares and analyzes the advantages and disadvantages of the two methods. Friends in need can refer to it.

A PHP class tree (supports unlimited classification)_PHP tutorialA PHP class tree (supports unlimited classification)_PHP tutorial

21Jul2016

A PHP class tree (supports unlimited classification). Recently, there have been a lot of questions asked about infinite classification trees, so I was happy to write one myself. I just finished it. You can try it and see how to implement it faster and simpler. Post your tree as well.

PHP calls the dll class library method developed by C#, _PHP tutorialPHP calls the dll class library method developed by C#, _PHP tutorial

13Jul2016

PHP calls the dll class library method developed in C#. PHP calls dll class library methods developed in C#. Sometimes, we need to use dll class libraries written in other languages ​​in php, such as dlls written in C#. The method is to use the PHP new COM method to call.

PHP MySQL method to implement unlimited classification columns, _PHP tutorialPHP MySQL method to implement unlimited classification columns, _PHP tutorial

12Jul2016

PHP MySQL method to implement unlimited classification columns. PHP MySQL's method of implementing unlimited classification columns. This article describes the method of PHP MySQL's implementation of unlimited classification columns. Share it with everyone for your reference, the details are as follows: A very simple

See all articles