Home  >  Article  >  Backend Development  >  Creation of database and data table for novel website development

Creation of database and data table for novel website development

巴扎黑
巴扎黑Original
2017-07-23 10:12:473954browse

The most important link in php backend development is to create a database and establish a data table. Because it is directly related to the entire project, we first create a few data tables to lay the foundation for later writing programs

First we create a database article and then query the database

Here we are writing a novel site, so I will create a read database, directly open phpmyadmin, and create it in itCreation of database and data table for novel website development

Of course you can also use sql statements to write.

Then we have to create tables. Here I briefly see a few tables:

admin table:

CREATE TABLE IF NOT EXISTS `admin` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`username` varchar(15) NOT NULL,

`password` varchar(15) NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;

INSERT INTO `admin` (`id`, `username`, `password` ) VALUES

(1, 'admin', '540548356');

Creation of database and data table for novel website development

info table:

CREATE TABLE IF NOT EXISTS ` info` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`title` varchar(15) CHARACTER SET utf8 DEFAULT NULL,

`username` varchar( 15) DEFAULT NULL,

`qq` varchar(15) DEFAULT NULL,

`Email` varchar(15) DEFAULT NULL,

`address` varchar(15) CHARACTER SET utf8 DEFAULT NULL,

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=gbk AUTO_INCREMENT=57 ;

Creation of database and data table for novel website development

New book list:

CREATE TABLE IF NOT EXISTS `newbook` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`bookname` varchar(32) NOT NULL,

`images` varchar(50) NOT NULL,

`introduction` varchar(100) NOT NULL,

`author` varchar(11) NOT NULL ,

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=gbk AUTO_INCREMENT=4 ;

Creation of database and data table for novel website development

page table:

CREATE TABLE IF NOT EXISTS `page` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`title` varchar(15) NOT NULL,

`images` varchar(100) NOT NULL,

`content` varchar(100) NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=156 ;

Creation of database and data table for novel website development

user table:

CREATE TABLE IF NOT EXISTS `user` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`username` varchar(32) NOT NULL,

`password` varchar(32) NOT NULL,

` qq` varchar(32) NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;

Creation of database and data table for novel website development

We have completed the creation of a few tables, now we are going to do the backend development

The above is the detailed content of Creation of database and data table for novel website development. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn