宝马娱乐在线城-宝马娱乐在线

来自 互联网络 2019-10-01 17:10 的文章
当前位置: 宝马娱乐在线城 > 互联网络 > 正文

比较简单实用的PHP无限分类源码分享(思路不错

 

下面一段代码是创建相应数据库的sql代码:

 代码如下

复制代码 代码如下:

//////////////
//////无限分类的数据库设计及样例
//////////////
mysql> create database db_kind;
Query OK, 1 row affected

 //////////////
   //////无限分类的数据库设计及样例
   //////////////
   mysql> create database db_kind;
   Query OK, 1 row affected

mysql> use db_kind;
Database changed
mysql> create table tb_kind(
-> id int not null auto_increment primary key,
-> pid int,
-> path varchar(200)
-> );
Query OK, 0 rows affected

   mysql> use db_kind;
   Database changed
   mysql> create table tb_kind(
     -> id int not null auto_increment primary key,
     -> pid int,
     -> path varchar(200)
     -> );
 Query OK, 0 rows affected

mysql> insert into tb_kind values(null,"新闻",0,0);
Query OK, 1 row affected

 mysql> insert into tb_kind values(null,"新闻",0,0);
 Query OK, 1 row affected

mysql> insert into tb_kind values(null,"视频",0,0);
Query OK, 1 row affected

 mysql> insert into tb_kind values(null,"视频",0,0);
 Query OK, 1 row affected

mysql> insert into tb_kind values(null,"图片",0,0);
Query OK, 1 row affected

 mysql> insert into tb_kind values(null,"图片",0,0);
 Query OK, 1 row affected

mysql> insert into tb_kind values(null,"博客",0,0);
Query OK, 1 row affected

 mysql> insert into tb_kind values(null,"博客",0,0);
 Query OK, 1 row affected

mysql> insert into tb_kind values(null,"体育新闻",1,"0-1");
Query OK, 1 row affected

 mysql> insert into tb_kind values(null,"体育新闻",1,"0-1");
 Query OK, 1 row affected

mysql> insert into tb_kind values(null,"娱乐新闻",1,"0-1");
Query OK, 1 row affected

 mysql> insert into tb_kind values(null,"娱乐新闻",1,"0-1");
 Query OK, 1 row affected

mysql> insert into tb_kind values(null,"财经新闻",1,"0-1");
Query OK, 1 row affected

 mysql> insert into tb_kind values(null,"财经新闻",1,"0-1");
 Query OK, 1 row affected

mysql> select * from db_kind;
ERROR 1146 : Table 'db_kind.db_kind' doesnot exist
mysql> select * from tb
_kind;
+----+----------+-----+------+
| id | pname | pid | path |
+----+----------+-----+------+
| 1 | 新闻 | 0 | 0 |
| 2 | 视频 | 0 | 0 |
| 3 | 图片 | 0 | 0 |
| 4 | 博客 | 0 | 0 |
| 5 | 体育新闻 | 1 | 0-1 |
| 6 | 娱乐新闻 | 1 | 0-1 |
| 7 | 财经新闻 | 1 | 0-1 |
+----+----------+-----+------+
7 rows in set
mysql> insert into tb_kind values(null,"篮球新闻",5,"0-1-5");
Query OK, 1 row affected

 mysql> select * from db_kind;
 ERROR 1146 : Table 'db_kind.db_kind' doesnot exist
 mysql> select * from tb
 _kind;
 +----+----------+-----+------+
 | id | pname    | pid | path |
 +----+----------+-----+------+
 |  1 | 新闻     |   0 | 0    |
 |  2 | 视频     |   0 | 0    |
 |  3 | 图片     |   0 | 0    |
 |  4 | 博客     |   0 | 0    |
 |  5 | 体育新闻 |   1 | 0-1  |
 |  6 | 娱乐新闻 |   1 | 0-1  |
 |  7 | 财经新闻 |   1 | 0-1  |
 +----+----------+-----+------+
 7 rows in set
 mysql> insert into tb_kind values(null,"篮球新闻",5,"0-1-5");
 Query OK, 1 row affected

mysql> insert into tb_kind values(null,"足球新闻",5,"0-1-5");
Query OK, 1 row affected

 mysql> insert into tb_kind values(null,"足球新闻",5,"0-1-5");
 Query OK, 1 row affected

本文由宝马娱乐在线城发布于互联网络,转载请注明出处:比较简单实用的PHP无限分类源码分享(思路不错

关键词: