How PHP implements the directory tree next to the CSDN forum

Source: Internet
Author: User
After connecting the database, put the table data into $row
CREATE TABLE ' list ' (' Id ' int () unsigned not NULL auto_increment, ' father_id ' int () unsigned DEFAULT ' 0 ', ' Name ' varchar (+) Not NULL, ' thing ' varchar ($) Default null,primary KEY (' cate_id ') engine=myisam default Charset=utf8 auto_increme nt=34;

INSERT into ' list ' (' Id ', ' father_id ', ' Name ', ' thing ') VALUES (1, 0, ' programming ', ' language '), (2, 0, ' network ', ' Knowledge '), (3, 1, ' php ', ' Dynamic '), ( 4, 0, ' life ', ' interests ');

After I write the database connection, I use Mysql_fetch_array () to put the data into the array $row, and then how to display the array traversal as a tree? Small white One, can be specifically taught, thank you!!!


Reply to discussion (solution)

Right-click to view the source code, you can see that it is written as follows:



Mobile development


Ios
Android
Qt
Wp



Cloud computing


Iaas
Pass/saas
Distributed computing/hadoop




DL, DT, DD are the HTML of the list, refer to Http://www.w3school.com.cn/tags/tag_dd.asp
As for the display as CSDN this will use CSS and JS.

Ztree ....

2 floor is said to be static, I want to achieve is to read the database display, right-click the source code is processed
3 Floor I check the internet is also said Ztree, but do not understand

I solved it myself. The idea is probably:
1. Storing the database data in an array;
2. Transform the data into a tree-shaped array, and implement the Subarray to find the parent array;
3. Convert the tree-shaped array to HTML code;
4. Add CSS to beautify.
Thank you for your reply.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.