Great job on completing this lesson. Let’s take a moment to review some of the material covered in this lesson:
- Databases store data for PHP applications.
- PDO lets us write code that will work with many common database systems.
- We write queries by inserting SQL into the
- SQL queries with user-defined parameters (variables) are vulnerable to SQL injection.
- We use prepared statements to prevent SQL injection.
- Prepared statements use the
execute()methods and send SQL commands and data separately.
- For exception handling, we wrap code in a
- We use exception handling to catch and handle exceptions when our program throws them.
- We can use methods on the exception object to troubleshoot exceptions.
You’re now well on your way to creating database-driven PHP applications!
Looking for some more practice? Consider adding tables to the database and writing more complex SQL statements.