Getting Data from MySQL
In the last lesson you learned about API’s and how that can enable a connection between PHP and MySQL. We discussed the 5 steps of interaction between PHP and MySQL (connect, query, use, release and disconnect). Then you learned how to create a connection between your PHP page and your MySQL database. You also learned how to close that connection. As a bonus we talked a little about back-up strategies now that you are creating PHP files and MySQL tables.
In this lesson you will learn how to use your database connection to retrieve and use data from your database. You will learn how to use three new MySQL functions to query, retrieve and free data, they are:
- mysqli_query() used to query the database
- mysqli_fetch_row() used to work with retrieved data
- mysqli_free_result() used to free retrieved results to free up memory
Query the database
Let’s start with step 2, performing a database query.
**More to follow