PHP develops a simple book lending system to create database and user table

First we create a database about books, named book.

connect_error) { die("连接失败: " . $conn->connect_error);} // 创建数据库 $sql = "CREATE DATABASE book"; if ($conn->query($sql) === TRUE) { echo "数据库创建成功"; } else { echo "Error creating database: " . $conn->error; } $conn->close(); ?>

Create a table in the database that needs to be used for user registration and login, named user

Set the following fields:

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

name: User name, type is varchar, length is 100.

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

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

tel: Telephone, type is varchar, length is 100.

address: Address, type is varchar, length is 200.

Of course you can also create it directly in phpMyAdmin.

Write the created database table into the config.php file so that we can call the database table on differentpages in the future.


Continuing Learning
||
connect_error) { die("连接失败: " . $conn->connect_error);} // 创建数据库 $sql = "CREATE DATABASE book"; if ($conn->query($sql) === TRUE) { echo "数据库创建成功"; } else { echo "Error creating database: " . $conn->error; } $conn->close(); ?>
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!