In this solution to the challenge assignment, Kevin demonstrates how to write validations, which will be called before data in the pages table is created or updated, and to display any validation errors that are found.
- [Narrator] Hopefully, you did well with…the challenge assignment to do page validations.…In this movie, I'm going to show you…the solution that I came up with.…The first thing that I did was I created…a validate_page function which takes…an associative array; that's all the page…attributes that we're going to be working with later and…I'm going to use an errors array to keep track of any problems.…Then, I'm going to go through and I'm going to check and see…various attributes; I'm going to check and see…if subject id is blank; if it is blank,…then I'm going to say subject cannot be blank.…I'm going to do the same thing for menu name.…I'm going to use the same kinds of things…we had on subject that is not blank…and also check that it's between two and 255 characters.…
Then for position, I'm going to check and make sure…that it's greater than zero but less than 999.…For Visible, I'm going to make sure it's either…a zero or a one and then for the Content,…I'm just going to make sure that the Content is not blank.…
- 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
MVC Frameworks for Building PHP Web Applicationswith Drew Falkman2h 57m Intermediate
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.