PHP develops a simple book lending system to create a homepage database table
Create a table in the database that needs to be used for the main page, named yx_book
Set the following fields:
id: It is unique, type is int, and select the primary key .
name: Book name, type is varchar, length is 20.
price: Price, type decimal(4,2), used for data storage with relatively high precision.
The declaration syntax of decimal column is decimal(m,d).
1. M is the maximum number of numbers (precision). Its range is 1 to 65 (in older MySQL versions, the allowed range was 1 to 254).
2. D is the number of digits to the right of the decimal point (scale). Its range is 0~30, but it must not exceed M.
uploadtime: storage time, type is datetime.
type: Book classification, type is varchar, length is 10.
total: The number of books, type is int, length is 50.
leave_number: The number of remaining books that can be borrowed, type is int, length is 10.
Create another user borrowing table named lend
Set the following fields:
id: It is unique and the type is int. and select the primary key.
book_id: The id of each book, type is int
book_title: Type is varchar, length is 100.
lend_time: borrowing time, type is datetime.
user_id: user id, type is int
Of course you can also create it directly in phpMyAdmin.