Unlimited classification of PHP using concat

Source: Internet
Author: User
What is the unlimited classification of concat in PHP ?? I. Database Design :?? ---- Tablestructurefortable 'Category '-- CREATETABLE 'Category' ('id' int (11) NOTNULLauto_increment, 'catpath' varchar (255) PHP uses unlimited concat classification

?

?

I. database design:

?

?

-- Table structure for table 'Category '-- create table 'Category' ('id' int (11) not null auto_increment, 'catpath' varchar (255) default NULL, 'name' varchar (255) default NULL, primary key ('id') ENGINE = MyISAM default charset = utf8 AUTO_INCREMENT = 11; -- Dumping data for table 'Category '-- insert into 'category' VALUES (1, '0', 'Website'); insert into 'category' VALUES (2, '0-1', 'Linux OS '); INSERT INTO 'category 'values (3, '0-1', 'Apache server '); insert into 'category 'values (4, '0-1', 'MySQL database'); insert into 'category 'values (5, '0-1 ', 'php scripting language '); insert into 'category' VALUES (6, '0-1-2', 'Linux system example'); insert into 'category' VALUES (7, '0-1-2 ', 'Linux network technology'); insert into 'category 'values (8, '0-1-2 ', 'Linux security basics '); insert into 'category 'values (9, '0-1-2-7 ', 'Linux LAMP'); insert into 'category 'values (10, '0-1-3-10 ', 'Apache server ');

?

?

Here, The-link symbol of catpath is not fixed and can be selected, and other special symbols.

II. PHP code implementation:

?

?

 '; * // Second display method $ space = str_repeat ('', count (explode ('-', $ row ['abspath'])-1 ); $ option. =''. $ Space. $ row ['name'].'';} Echo''. $ Option .'';?>

?

The MySQL concat function can be used to connect one or more strings.
Select concat ('Yan ', 'pei', 'Pan ')
Select 'id', 'name', concat ('id', '-', 'name') as iname

?

?

?

Association:

Simple unlimited classification class category, menus, jquery tree view?

?

?

?

?

?

?

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.