Learn how to add a file to store the database credentials that the database-driven application will need to use.
- [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 those developers.…Misspelled multiple there.…There we go.…So that's just a reminder…why we want to keep these in a separate file.…
Note: This is an intermediate-level training course that assumes you have existing knowledge of PHP. To refresh your skills, check out PHP Essential Training and PHP: Object-Oriented Programming.
- Creating a project database and tables
- Connecting to the database
- Database queries with OOP
- The active record design pattern
- Defining a database-driven class
- Performing common database tasks with OOP
- Creating inheritable and reusable code
- Object-oriented user authentication
- Object-oriented pagination
Skill Level Intermediate
Consuming RESTful APIs in PHP with Guzzlewith Justin Yost2h 12m Intermediate
PHP: Accessing Databases with PDO and MySQLiwith David Powers3h 47m Intermediate
1. Overview and Project Setup
2. The Database Connection
3. Define a Database-Driven Class
4. Object-Oriented CRUD
5. Object-Oriented Authentication
6. Object-Oriented Pagination
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.