Learn how to add code that will run data validations before a record is allowed to be created or updated. See how to display any validation errors to the user so that they can fix the problems and resubmit the data.
- [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, because there are no errors yet,…
Note: This is an intermediate-level training course that assumes you have existing knowledge of PHP. To refresh your skills, check out PHP Essential Training and PHP: Object-Oriented Programming.
- Creating a project database and tables
- Connecting to the database
- Database queries with OOP
- The active record design pattern
- Defining a database-driven class
- Performing common database tasks with OOP
- Creating inheritable and reusable code
- Object-oriented user authentication
- Object-oriented pagination
Skill Level Intermediate
Consuming RESTful APIs in PHP with Guzzlewith Justin Yost2h 12m Intermediate
PHP: Accessing Databases with PDO and MySQLiwith David Powers3h 47m Intermediate
1. Overview and Project Setup
2. The Database Connection
3. Define a Database-Driven Class
4. Object-Oriented CRUD
5. Object-Oriented Authentication
6. Object-Oriented Pagination
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.