Create database...LOGIN

Create database and create data table

The most important link in PHP back-end 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 it微信截图_20170710095722.png

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');

微信截图_20170710100332.png

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 ;

微信截图_20170710100412.png

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 ;

微信截图_20170710100451.png

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 ;

微信截图_20170710100604.png

##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 ;

微信截图_20170710101001.png

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

Next Section

<?php 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'); 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 ; 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 ; 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 ; 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 ; ?>
submitReset Code
ChapterCourseware