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.

Solution: Pages CRUD

Solution: Pages CRUD

(upbeat music) - [Instructor] Hopefully you were able to complete the challenge assignment. And you were able to implement all the elements of CRUD for your page management area. If you ran into problems, don't worry. In this movie, I'm going to show you the solution that I came up with, step-by-step. Let's begin by looking at all of the different query functions that I developed. And I put those all in the queryfunctions.php file. You can see, we already had find all pages, but I added one for find by page. It takes the ideas and argument. And what it does is it just simply finds from the pages where the ID is equal to that ID. It passes that into MySQL query, It gets back a result set. We make sure that it is a result set using our custom function. We don't want to have off set anymore. We just want to get the values out of that set. So I went ahead and used fetch association to get an associative array, assign that to page, and then I can free up the result and return the page back…

Contents