Database construction of php user registration and login system

Database analysis

The database for registration and login contains a user table, and there should be at least three in the table Fields, number, username and password

Field details are as follows:

##intvarcharvarcharField lengthField descriptionNumberUsernamePassword

Next, let’s create the database

Database creation

We are using phpMyAdmin To create a simple database

First log in to the database. The username and password were set when we installed the database. My username and password are both root

sql1.png

After successful login, click Database on the top page , Then fill in the name of the database we want to create under the new database , and select utf8_general_ci for encoding (multi-language, case-insensitive)

1.png

#Click to create:

2.png

Now we create a data table containing three fields in the database

3.png

Click Execute and fill in the details of each field ( Note: You need to choose an auto-increment for the id field, that is, select the option

A_I):

4.png##After filling in, click Save:

5.pngOkay, at this point, the database required for this project has been built

Note: If you can’t see the picture clearly, right-click on the picture Select View Picture to see the big picture Continuing Learning

||
<!DOCTYPE html> <html> <head> <title>php.cn</title> <meta charset="utf-8" /> <style> .box{ width:250px; height:120px; background:#f0f0f0; } </style> </head> <body> <!-- 注册界面 register.php--> <div class="box"> <form action="regcheck.php" method="post"> <table> <tr> <td align="right">用户名:</td> <td><input type="text" name="username" value="请输入用户名" maxLength="6"/></td> </tr> <tr> <td align="right">密 码:</td> <td><input type="password" name="userpwd" maxLength="6"/></td> </tr> <tr> <td align="right">确认密码:</td> <td><input type="password" name="confirm" maxLength="6"/></td> </tr> <tr> <td colspa="2" align="right"><input type="Submit" name="Submit" value="注册"/></td> </tr> </table> </form> </div> </body> </html>
submitReset Code
##Field name

id

username

userpwd

Field type

10
2020