Record the methods of learning PDO technology to prevent SQL injection
I recently learned how to use PDO technology to prevent SQL injection as a note on my blog. If there is a new feeling to add a stroke, after all, it is just the beginning to learn.
What is PDO
The PDO full name PHP Data ObjectPHP data object (PDO) extension defines a lightweight and consistent interface for PHP to access the database. PDO provides a data access abstraction layer, which means that no matter which database you use, you can use the same function (method) to query and retrieve data.
Second, how to use PDO to prevent SQL injection?
/
Prevent sql injection here use the quote () method to filter special characters and prevent SQL injection by preprocessing and binding parameters of the bindParameter () method
/
Third, use the quate () method to prevent sql injection.
The Quate () method returns a quoted string, filtering special characters
1. First create a login screen to submit the user name and password.
2. Then create a background processing PHP file, obtain the user name and password, and query in the database. Basic query methods to query.