PHP unlimited classification database preparation
Database preparation:
Create tabledeepcate:
CREATE TABLE IF NOT EXISTS `deepcate` ( `id` int(4) NOT NULL, `pid` int(11) NOT NULL, `catename` varchar(30) NOT NULL, `cateorder` int(11) unsigned NOT NULL DEFAULT '0', `createtime` int(10) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COMMENT='分类表';
Import test data:
INSERT INTO `deepcate` (`id`, `pid`, `catename`, `cateorder`, `createtime`) VALUES (1, 0, '新闻', 0, 0), (2, 0, '图片', 0, 0), (3, 1, '国内新闻', 0, 0), (4, 1, '国际新闻', 0, 0), (5, 3, '北京新闻', 0, 0), (6, 4, '美国新闻', 0, 0), (7, 2, '美女图片', 0, 0), (8, 2, '风景图片', 0, 0), (9, 7, '欧美明星', 0, 0), (10, 9, '英国电影', 0, 0);