PHP development message board tutorial to create a database

Create a message database

1.png

Then we use the command to view all databases

2.png

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;

3.png

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)

);

4.png

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)

);

5.png

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.

6.png

In this way, our two tables have been created

Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!