php无限分类使用concat如何实现,php无限分类concat一、数据库设计
-- -- 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', '网站首页'); insert into `category` values (2, '0-1', 'linux os'); insert into `category` values (3, '0-1', 'apache服务器'); insert into `category` values (4, '0-1', 'mysql数据库'); insert into `category` values (5, '0-1', 'php脚本语言'); insert into `category` values (6, '0-1-2', 'linux 系统教程'); insert into `category` values (7, '0-1-2', 'linux 网络技术'); insert into `category` values (8, '0-1-2', 'linux 安全基础'); insert into `category` values (9, '0-1-2-7', 'linux lamp'); insert into `category` values (10, '0-1-3-10', 'apache server');
这里说明下,catpath的-链接符号不是固定的,可以选择,;等特殊符号。
二、php代码实现
mysql concat函数可以连接一个或者多个字符串
select concat('颜','培','攀')select `id`,`name`,concat(`id`,'-',`name`) as iname
以上就是本文的全部内容,介绍了php使用concat实现无线分类,希望对大家的学习有所帮助。
http://www.bkjia.com/phpjc/1068831.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/1068831.htmltecharticlephp无限分类使用concat如何实现,php无限分类concat 一、数据库设计 -- -- table structure for table `category` -- create table `category` ( `id` int(11) not null...