Learn to use the built-in, object-oriented version of the MySQLi database adapter to connect to the database.
- [Instructor] Now that we have…our database credentials installed,…let's see how we connect to the database…using object-oriented programming.…First, let's begin by reviewing the procedural version…which we've used to connect to the databases with PHP…up until now.…To do that, we used a function called mysqli_connect…and we passed in several arguments…for the server, the user, the password,…and the database name.…That function returns back a database handle…which can then be used…to connect to the database in the future.…
It opens up a connection…and we're able to then…work with that connection going forward.…So for example if we want to query the database,…we can call another function mysqli_query.…We pass in that database handle…as well as the SQL that we want to query.…This is a procedural style.…There's no object-oriented programming here,…and we're just calling basic PHP functions.…The mysqli adapter also has an object-oriented version…as well as the procedural version.…
In order to create a new database connection,…
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.