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
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');
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 ;
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 ;
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 ;
##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 ; We have completed the creation of a few tables, now we are going to do the backend development