PHP development corporate website tutorial to create a database
First we create the database article and then query the database
In this way our database has been established
Then we need to select the article database Right Database operation;
Use command: use article;
Then we have to create the table
Administrator table:
CREATE TABLE user(
id INT NOT NULL AUTO_INCREMENT,
username VARCHAR(10) NOT NULL,
password VARCHAR(32) NOT NULL,
PRIMARY KEY (id)
); DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
##This way our administrator table has been completed About us CREATE TABLE about( id INT NOT NULL AUTO_INCREMENT, title VARCHAR(10) NOT NULL, content VARCHAR( 300) NOT NULL, PRIMARY KEY (id) ); DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci Contact us CREATE TABLE contact( id INT NOT NULL AUTO_INCREMENT, site VARCHAR(30) NOT NULL, tel VARCHAR(15) NOT NULL, support VARCHAR(15) NOT NULL, nexttel VARCHAR(15) NOT NULL, fax VARCHAR(15) NOT NULL, home VARCHAR(15) NOT NULL, email VARCHAR(15) NOT NULL, PRIMARY KEY (id) ); DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci Note: The following is the meaning of each field site company address|tel company phone number|suppot technical support|netxtel after-sales phone number|fax Company fax|hone Company homepage|email Email
##News information form
CREATE TABLE news(
id INT NOT NULL AUTO_INCREMENT,
type VARCHAR(10) NOT NULL,
title VARCHAR(32) NOT NULL,
content VARCHAR(32) NOT NULL,
newtime VARCHAR(30) NOT NULL,
PRIMARY KEY (id)
); DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
Product table
CREATE TABLE product(
id INT NOT NULL AUTO_INCREMENT,
title VARCHAR(32) NOT NULL,
imgname VARCHAR(50) NOT NULL,
price VARCHAR(20) NOT NULL,
goodtime VARCHAR(30) NOT NULL,
PRIMARY KEY ( id )
); DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
We have completed the creation of several tables, and now we are going to do the background development