From the course: PHP with MySQL Essential Training: 1 The Basics
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Work with retrieved data
From the course: PHP with MySQL Essential Training: 1 The Basics
Work with retrieved data
- [Instructor] We've learned how to use PHP to connect the MySQL database and how to query the database to get back a result set. In this movie, we're going to learn the options we have for working with those results sets. There are three things we're going to look at. We're going to look at mysqli_fetch_row, mysqli_fetch_assoc, short for association, and mysqli_fetch_array. Mysqli_fetch_row is going to return the results back from a result set as standard arrays. So for example, if we had a subject's result set that we pull back from the database, use mysqli fetch_row to get the first row of data from that, it would return back a standard array that looks something like this. The first item is one, that's the ID, the second one is the menu name and then the third one would be the position, and the fourth one would be visible. In order to access these values, because it's the standard array, we would just use integers, that's how the keys are indexing it. So if we wanted to take a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.