PHP Database Programming PHP has three methods to operate our database: 1. MySQL extension library 2. mysqli extension Library 3. PDO Differences between MySQL extension library and MySQL database Next we will introduce the MySQL extension Library: 1. MySQL database is used to store data 2. The three-tier structure of MySQL database: all databases basically follow these three structures, 3. MySQL extension library is a bunch of functions provided by PHP designers Program Complete various MySQL database operations (crud) Use the MySQL extension library of PHP to perform database operations: 1. Establish the environment 1.1 enable MySQL extension Library
Configure the MySQL extension library in the PHP. ini file Extension = php_mysql.dll Extension = php_mysqli.dll We can use <? PHP phpinfo ();?> To check which database functions are currently supported 1.2 create a user table for our use
Create Table user1 (ID int primary key auto_increment, name varchar (32) not null, password varchar (64) not null, email varchar (128) not null, age tinyint unsigned not null)
Insert data
Insert into user1 (name, password, email, age) value ('jsh', MD5 ('000000'), '2017 @ QQ.com ', 20)
Here we encrypt the password
When the user name is a Chinese character, an error is returned. You need to set it.
- Previous:PHP self-learning path ------- File Download
-
Top
-
0
-
Step on
-
0