In the previous article MySQL basic knowledge, we talked about the installation and basic operations of MySQL (mainly the query operation of a single SQL statement). Today we introduce a very important part of MySQL: preprocessing.
In mysqli operations, its three main classes are often involved: MySQLi class, MySQL_STMT class, and MySQLi_RESULT class. Preprocessing is mainly done using the MySQL_STMT class.
Preprocessing is an important means of preventing SQL injection and is of great significance to improving website security.
The case of this article is that the database name is test, the data table name is test, the fields include id and title, and the id is an auto-increasing primary key.
1 2 3 4 5 |
|
Use mysqli preprocessing to prevent sql injection:
1 2 3 4 |
|
Use mysqli preprocessing to execute query statements:
1 2 3 4 5 |
|
The above is the detailed content of Detailed explanation of preprocessing examples of php mysqli extension. For more information, please follow other related articles on the PHP Chinese website!