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.