In this video, you will review the code for several common validations and install several examples as a reusable function. You will also use an array to tally the errors and prevent any database interaction when there are errors present.
- [Narrator] In this movie,…we'll begin adding validation functions to our project.…The first thing we should think about is…where we want to put these validations.…We want to validate the data before we create…or update records in the database.…That's the right place to enforce these rules.…So the form data comes in from the user,…we run our validations,…and then we either create or update the records.…Often we want to use the same validations…for both creating and updating.…And that's because the rules about…what data is acceptable when we're creating record,…are usually the same rules about the data…that's acceptable when we're updating a record.…
It's not always true, but most of the time it is.…In that case, you want to put your validation code,…in a reusable function,…so that you can call it in both cases.…And the same rules would be applied.…You wouldn't want to inadvertently have one set…of rules for creating data,…and a different set of rules for updating data.…And then, if our validations fail,…the create or the update would be prevented.…
- Organizing project files
- Including and requiring files
- Working with URL parameters
- Encoding dynamic content
- Modifying headers and page redirection
- Creating forms and processing form data
- MySQL basics
- Using PHP to access database tables
- Creating, reading, updating, and deleting database records with PHP
- Validating data
- Preventing SQL injection
Skill Level Beginner
1. Start a Database-Driven Project
2. Build Web Pages with PHP
3. Headers and Redirects
4. Build Forms with PHP
5. MySQL Basics
6. Use PHP to Access MySQL
7. CRUD with PHP
8. Validate Data with PHP
9. Prevent SQL Injection
Next steps1m 8s
- 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.