Getting to Know the Project6:35 with Alena Holligan
Building a php-driven page is just the first step in mastering PHP. The true power of PHP shines when you connect it to a data source like an API or a Database. In this course, we’ll refactor an application to use a database to store the information. This will make our application easier and faster to scale. It will also make it easier and faster to add functionality like the search and pagination we’ll also be adding in this project.
Learn More About Relational Databases
Using the Database Locally
Included in the download is a .sql file for importing the data into another database such as MySQL. Once you have this file, you can choose one of the following options for loading the database into your local dev environment
CAREFUL: These steps will replace all tables in any existing database named "database"!
1. Import Database into MySQL using phpMyAdmin
Then choose the import tab and select the downloaded database.sql file.
2. Importing Database into MySQL using Command Line
Open a new terminal (Mac) or command line (Windows) window
[PATH_TO_MYSQL] -u [USERNAME] -p < [PATH_TO_SQL_FILE] Hit the Enter Key
Example Mac with MAMP: /applications/MAMP/library/bin/mysql -u root -p < /Downloads/database.sql
Example Windows with MAMP: c:/MAMP/bin/mysql/bin/mysql -u root -p < c:/Downloads/database.sql
Quick Tip: Don’t forget that you can simply drag the file into the terminal window and it will enter the location of the file for you.
You should be prompted with the following line:
Type your password, keep in mind that the letters will not appear, but they are there Hit the enter key.
Quick Tip: By default, the MySQL password for MAMP is "root".
Check if you database was successfully imported Navigate to phpMyAdmin in a browser
You need to sign up for Treehouse in order to download course files.Sign up