Database Configuration Files in PHP

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:05
    with Leanna Pelham
  • 0:08
    The home page is loading pet data from the database,
  • 0:11
    but our contact page isn't.
  • 0:13
    It lists a different number of pets than we
  • 0:16
    know we have in the database.
  • 0:18
    Silly contact page.
  • 0:20
    The problem is that get_pets is still reading from the pets.json
  • 0:24
    file instead of using the database.
  • 0:29
    So instead of putting our query logic right inside of index.php,
  • 0:33
    why not just update get_pets to pull from the database?
Loading ...

Database Configuration Files in PHP

Loading...

To make it easier to control your app, configuration, like your database username and password, is usually isolated into its own file. In this tutorial we'll create a new file called config.php and see how to simplify our database information.

Downloads: 
Log in or sign up to download companion files.

Additional resources:
There are no resources for this video. If you believe there should be, please contact us.