Key Concepts

Review core concepts you need to learn to master this subject

Connecting to Databases
Lesson 1 of 1
  1. 1
    In our previous lesson, we looked at how to handle user input from forms. Combining PHP with a database will let us store the user input to use in our applications. In this lesson, we will learn ho…
  2. 2
    When working with databases, you may have used a graphical tool such as Postbird, PgAdmin, or PhpMyAdmin. These tools are clients, which create a connection to the database server and send …
  3. 3
    Now that we’ve created a database object, $db, we can call its methods to fetch data from the database. Let’s take a look at an example database. It contains a books table with a list of books wit…
  4. 4
    Although we can use PHP to send SQL queries to PostgreSQL, sometimes SQL queries can be dangerous. For example, how would we write a query that lets a user get a book’s details by providing its ID…
  5. 5
    So, how did you do with all those exercises? If your experience was anything like ours, you probably didn’t get everything right the first time. In fact, to let you in on a little secret, even the …
  6. 6
    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 …

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo