From the course: PHP: Object-Oriented Programming with Databases
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Validations and errors - PHP Tutorial
From the course: PHP: Object-Oriented Programming with Databases
Validations and errors
- [Narrator] Before we leave the topic of creating and updating records in the database, I want us to talk about validations and errors. This is a concept that we talked about in the PHP with MySQL essential training. The fundamental idea is that we want to have control over the quality of data that gets saved to the database. Not all data is necessarily acceptable, and we want to be able to control that so that we have control over what goes in and comes out of our application. One way to do that is with validations. We check to see if data meets our standards before we put it in the database. And if it doesn't, then we want to know what went wrong, and we want to tell the user about it so that they can fix the problem, and try to submit it again. So that's where validations and errors come in. The basic structure that we've been using for our validations is just that we're going to keep a list of the errors. So to start with, we'll have an array of errors, that's going to be empty…
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)
-
-
-