Integrating PHP with Databases
![Treehouse](https://static.mytechlogy.com/cache/837bb01961ab4429c6b8cbecf077a2aa_w30_h30_cp_sc.png)
Treehouse
Course Summary
Building a PHP-driven page is the first step in mastering PHP. The true power of PHP shines when you connect it to a data source like an API or a Database. To introduce you to databases, we'll use an example project -- a Personal Media Library application. We'll refactor this project by replacing an associative array with a database to provide a more robust and scalable tool to store the data in the media library. In the process, you'll learn how to use PDO -- a PHP extension to communicate with a database. You'll also learn about relational databases including how to search for data across multiple tables, as well as how to add common web site features like search forms and pagination.
-
+
Course Description
About this Course Building a PHP-driven page is the first step in mastering PHP. The true power of PHP shines when you connect it to a data source like an API or a Database. To introduce you to databases, we'll use an example project -- a Personal Media Library application. We'll refactor this project by replacing an associative array with a database to provide a more robust and scalable tool to store the data in the media library. In the process, you'll learn how to use PDO -- a PHP extension to communicate with a database. You'll also learn about relational databases including how to search for data across multiple tables, as well as how to add common web site features like search forms and pagination. What you'll learn
- Databases
- Error Handling
- Pagination
- Search
- Refactoring
About the Teacher
When not at her computer, Alena enjoys exploring Portland with her friends and family, including her 3 young children. She also enjoys the Symphony, Cooking, Books, Yarn and Yoga.
-
+
Course Syllabus
Databases and PHP
Building a php-driven page is just the first step in mastering PHP. The true power of PHP shines when you connect it to a data source like an API or a Database. In this course, we’ll refactor an existing project to use a database. We’ll then leverage the use of this database for pagination and search capabilities. 8 steps- Getting to Know the Project 6:35
- Introducing Objects 3:45
- Working with Objects 5 questions
- Getting Started with PDO 4:13
- PHP & Databases with PDO 1 objective
- Handling Exceptions 4:23
- More Exceptions 4:57
- Exception Handling 5 questions
Querying the Database with PHP
After the connecting to a database, we can use that database to retrieve the data for our project. We’ll see how to run a select, retrieve the results, and integrate those results into our site. 8 stepsUsing Relational Tables
A relational database can offer you robust and easy interaction with your data. It is built on the relationships between the data. When we are on our details page we need to pull many more details about the specific item, including information from other tables. To do this we’re going to use the relationships in our database to JOIN data from multiple tables. We’ll also use our PHP Data Object to address security concerns. 11 stepsLimiting Records in SQL
We will modify our functions to use their own SQL queries to retrieve only the items we need in the first place. As we do this, we'll look at a number of different ways to use SQL-specific features like limits, ordering and aggregate functions to fine tune our queries 13 stepsFiltering Input for Queries
We’re ready to add one of the most important features of any collection. Search capabilities! This is such an important feature, I want to add a search box to every page. Thankfully that’s easy to do because we already have a header file that’s included on all the pages so we can add a search box right below our header bar. Then we’ll make some modification to our catalog page so we can use that same code to display results. 8 steps