From the course: PHP: Object-Oriented Programming with Databases
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Update a record - PHP Tutorial
From the course: PHP: Object-Oriented Programming with Databases
Update a record
- [Instructor] In this movie, we're going to finish learning to update a record, using object oriented programming and our active record design pattern. So far, we've completed the first part of the update process, which is that we've retrieved a row of data from the database, and turned it into an object, so that we can present it as a form for the user, so the user can edit its properties. Now we need to do the second part, which is we need to take the values that the user submits, and we need to update a row in the database, using SQL. So here's the form that we created in the last movie, what we want now is when we click Edit Bicycle, and it submits a post_request, we want it to update the values in the database. So let's go to our code on edit.php, and you can see down here we took care of when we have a get request, that's the else down here, up here is if it's a post_request, if this form is being submitted. And you can see that we're getting all of the different values that we…
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.
Contents
-
-
-
-
-
-
(Locked)
CRUD operations5m 59s
-
Create a record9m 35s
-
(Locked)
Dynamic attribute list7m 59s
-
(Locked)
Sanitize values for database4m 40s
-
(Locked)
Find record to update8m 34s
-
(Locked)
Update a record11m 30s
-
(Locked)
HTML forms for OOP5m 38s
-
(Locked)
Validations and errors8m 22s
-
(Locked)
Delete a record7m 21s
-
(Locked)
Create inheritable code11m 12s
-
(Locked)
-
-
-