Create database...LOGIN

Create databases and tables for background content page display tables and classifications

Earlier we created the vidoe database and created the administrator login form.

Now that we are going to start implementing the functions of the main page, we need to create a table for managing content and a table for managing categories.

First create a content management table: list Table

Set the following fields:

id: It is unique, type is int, and Select the primary key.

name: Video name, type is varchar, length is 20.

title: Video introduction, type is varchar, length is 200.

video: Video, type is varchar, length is 100.

time: Timestamp, type is int, length is 20.

cate_id: Category id, type is int, length is 10.

<?php
$SQL = " CREATE TABLE IF NOT EXISTS `list` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(20) NOT NULL,
  `title` varchar(200) NOT NULL,
  `video` varchar(100) NOT NULL COMMENT '视频存放路径',
  `time` int(20) NOT NULL COMMENT '视频上架时间',
  `cate_id` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=45 DEFAULT CHARSET=utf8 COMMENT='视频展示表'";
?>

Create a classification table: cate Table

Set the following fields:

id: It is unique, type is int, and Select the primary key.

pid: Parent class id, type is int, length is 10.

cate_name: Category name, type is varchar, length is 30.

rank: Classification level, type is int, length is 10.

<?php
$SQL = " CREATE TABLE IF NOT EXISTS `cate` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `pid` int(10) NOT NULL COMMENT '父类id',
  `cate_name` varchar(30) NOT NULL,
  `rank` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='分类表'";
?>


Next Section
<?php $SQL = " CREATE TABLE IF NOT EXISTS `cate` ( `id` int(10) NOT NULL AUTO_INCREMENT, `pid` int(10) NOT NULL COMMENT '父类id', `cate_name` varchar(30) NOT NULL, `rank` int(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='分类表'"; ?>
submitReset Code
ChapterCourseware