Learn how to use the exercise files that accompany the course.
- [Narrator] This course includes exercise files in order to make use of these exercise files you'll want to first make sure that you have PHP and Mysql installed and working. The exercise files are arranged by chapter and by movie and you can find the exercise files that correspond to the movie that you're watching by first looking for the chapter number and then the movie number. You should copy the exercise files into your web document root directory. That is the location where your web server will look for files when a browser requests them.
On my Mac that will be inside my User Directory in my Sites Directory. It's always a good idea to make a copy of the exercise files so that you still have the original to refer back to if you make changes. I will option drag files into my Sites Directory to create a new copy. Our project will also use a database and for the exercise files to work, your database needs to match what the files expect. In many of the exercise files you will find a database file that you can load into Mysql to put your database into the same state as mine.
If you don't already have a database, the first few movies of chapter one will get you started. You can load that file directly into a MySQL database either by using a tool such as PHP My Admin or by going to a command line application and typing Mysql-u and then root for the root user or another user that has privileges on the database. We'll use -p to say we want to provide our password and the name of the database. In this case it will be Chain gang.
And then we'll use a less than sign followed by the path to the SQL file. If you're on a Mac, you may just be able to drag the file into the directory to avoid having to type it all out. Once we hit return it will ask for my password and now my database should be in the correct state. Note that the import will remove all old database data at the same time as it imports new data. Importing can also be useful if you do a lot of experimenting on your own but then want to get your data back in sync with mine.
Once you have the files in place you'll be able to follow along with me. Everything that is in the exercise files we're going to create together during the tutorials so you can just work along with me and your files will mirror what's in the exercise files. Remember that you can pause the video or rewind it if you need more time to copy something down. You can also use the exercise files to check your work or to get back in sync if you decide to experiment on your own.
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