Discover what you need to know before taking this course.
- [Narrator] There are a few things that you need to know before you start taking this course. The first is that there are several prerequisites. You want to make sure that you understand the fundamentals of working with the PHP language. I cover these fundamentals in my course, 'PHP: An Essential Training.' You also should be able to use PHP to connect to and interact with a MySQL database, as we demonstrate in 'PHP with MySQL Essential Training.' That is, you're able to connect to the database, to create records, to read records, to update them, and to delete them.
And, you also should already have the fundamentals of working with PHP in an object-oriented way. I covered these concepts in 'PHP: Object-Oriented Programming,' and you can refer back to that if you need some extra help. You don't have to take these exact courses, but you should be fluent in all of the concepts that are there, because this course is going to merge those concepts, the concepts of working with PHP and a database, along with the concepts of working with PHP in an object-oriented way.
And that's going to be very powerful, because object-oriented programming is going to offer us many benefits when we're working with databases, and that's what we want to explore in this course. There are also some preparations you should have in advance, you should make sure that you have a web server that's running, you should be able to identify your web document root, that is the place that you can put your files so that your web server will serve them out to you, you should ensure that PHP is installed and working. I'm going to be using PHP version 7, and you should either have that version or something later than that.
And you should ensure that MySQL is installed and working. And of course, you'll need a web browser, and text editor. I'm going to be using Firefox and the Atom text editor for myself. For me, my web document root is going to be inside my user directory, and inside my sites directory. So that's where I'm going to be putting my project files. One good way to confirm that you have a web server, and PHP running, that you correctly identified your web document root, is to put a test file into this directory and make sure that it loads up and runs PHP.
So I'm going to do that by opening up the Atom text editor, and I'll just put in a little bit of PHP here, with a special PHP function, PHP info, and then I'll close my PHP tags. And I'm going to save that, into that sites directory. I'm just going to call it 'my_phpinfo.php.' And now I can actually close that up, I don't need that anymore, you can see that it's here inside that sites directory, and then I'll go into a web browser and I'll load up 'localhost,' and for me it's going to be '~kevinskoglund.' You may not have that portion that you have to add, you might just be able to type 'localhost,' and then for my web document root, I'll type 'my_phpinfo.php.' You should get back a page of info about PHP, and it should say that you're running PHP version 7, or something later.
Now that I know that I have all of that running, let's also confirm that we have MySQL running, I can go to the command line, and I can type 'mysql --version,' and it'll tell me that I have my MySQL version 5.7, that version or anything later is fine. The versions don't matter as much with MySQL. And then, I can actually log into it with 'mysql -u' as the root user, with ' -p' option to provide the password, and I should be able to enter my password here, and then I can log in.
Now I'm inside MySQL, ready to create a new database. When we're done with that, we can simply type 'quit.' Once you've confirmed that you've met all the prerequisites, and you have all the parts that you need, you'll be ready to learn PHP object-oriented programming with databases.
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