PHP development message board tutorial to create a database
Create a message database
Then we use the command to view all databases
In this way our database Creation completed
We need to select the database first and then operate it, such as creating a table
use message;
such and that We can operate the database
Let’s create a user table, id username password
CREATE TABLE user(
id INT NOT NULL AUTO_INCREMENT,
username VARCHAR(10) NOT NULL,
password VARCHAR(32) NOT NULL,
PRIMARY KEY (id)
);
In this way, our user table has been created
The information about our messages must be stored in a table, let’s analyze it now
Id
Title 10 digits
Content 10 digits
Message time
Let’s create this table.
The table name is mess
CREATE TABLE mess(
id INT NOT NULL AUTO_INCREMENT,
title VARCHAR(10) NOT NULL,
content VARCHAR(200) NOT NULL,
messtime INT(11) NOT NULL,
PRIMARY KEY (id)
);
In this way, our message table is completed. Next, we can view the message database on the web management terminal to see whether the two tables we created have been completed.
In this way, our two tables have been created