From the course: PHP: Object-Oriented Programming with Databases

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Database credentials

Database credentials

- [Instructor] In this chapter we're going to learn how to use object-oriented code to connect and to query the database. If we're going to use a database then our application's going to need to know about our database credentials so that it can log out. Let's start by providing those to our application. So let's start by creating a new file inside the private directory. And I'm going to call that file db_credentials.php. And let's start out by just opening our PHP tags. We'll close them, and let's start by adding a comment here to the top. I'm going to have keep database credentials in a separate file. And the reason why we want to do that is one, it's easy to exclude this file from source code managers. The second reason is because it allows us to have unique credentials on development and production servers. And also if we're working with multiple developers it allows us to have unique credentials for each of…

Contents