PHP development...LOGIN

PHP development user registration module to create database and table

We continue to use phpMyAdmin to create MySql database and tables.

In the user login chapter we have explained in detail how to create databases and tables

Here we only need to add some variables that our registration module needs to use based on the last login. That's it.

In the login table under the test database, we added the confirmation password and email address.

Set the following fields:

id: It is unique, type is int, and select the primary key.

uesrname: Username, type is varchar, length is 30.

password: Password, type is varchar, length is 30.

confirm: Confirm password, type is varchar, length is 30.

email: Email, type is varchar, length is 30.

<?php
    // 创建连接
    $conn = new mysqli("localhost", "uesename", "password","test");
    // 检测连接
    if ($conn->connect_error) 
    {    
    die("连接失败: " . $conn->connect_error);
    } 
    // 使用 sql 创建数据表
    $sql = "CREATE TABLE login (
    id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(30) NOT NULL,
    password VARCHAR(30) NOT NULL,
    confirm VARCHAR(30) NOT NULL,
    email VARCHAR(30) NOT NULL,
    )ENGINE=InnoDB DEFAULT CHARSET=utf8 ";
    if ($conn->query($sql) === TRUE) 
    {    
    echo "Table MyGuests created successfully";
    } else {    
    echo "创建数据表错误: " . $conn->error;
    }
    $conn->close(); 
?>

You can also directly create a database and table through phpMyAdmin and directly insert fields

After completion, the table structure is as follows:

1.png

##In this way we The database and tables have been created.

Next Section

<?php // 创建连接 $conn = new mysqli("localhost", "uesename", "password","test"); // 检测连接 if ($conn->connect_error) { die("连接失败: " . $conn->connect_error); } // 使用 sql 创建数据表 $sql = "CREATE TABLE login ( id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY, username VARCHAR(30) NOT NULL, password VARCHAR(30) NOT NULL, confirm VARCHAR(30) NOT NULL, email VARCHAR(30) NOT NULL, )ENGINE=InnoDB DEFAULT CHARSET=utf8 "; if ($conn->query($sql) === TRUE) { echo "Table MyGuests created successfully"; } else { echo "创建数据表错误: " . $conn->error; } $conn->close(); ?>
submitReset Code
ChapterCourseware