In this solution to the challenge assignment, Kevin demonstrates how to develop code that will automatically adjust and shift the positions of other items whenever a subject or page is given a new position.
- [Instructor] It's time for me to show you the solution…that I came up with for automatically updating…the positions of our subjects and our pages.…Hopefully you got a solution working yourself,…but if not, don't get discouraged.…The first thing I want to do was write…this shift_subject_positions function.…So I've got a starting position, an ending position,…and then a current_id, and I defaulted that to zero.…That's because my sql statement has…and_id not equal to zero,…then it'll just do nothing because there are no items…that have an id of zero, so that's a good default to have.…
So I'm going to include my database so that I have access…to that later, and then I'm going to have a little line here…that says if the starting position and ending position…are equal to each other, well then don't do anything.…Nothing changed, so just return, and that's a nice little…fail-safe there that just bails out.…If that's not true, though,…then we do need to make some updates.…So the sql in every case is going to update the subjects…
- Creating a content management system
- Building dynamic content navigation
- Using context and function options for conditional behavior
- Hiding content from the public view
- Insecure direct object reference
- Allowing HTML in dynamic content
- Previewing content in the public context
- Working with cookies and sessions
- Storing status messages in the session
- Secure user authentication (login/logout)
- Regulating page access
- Nesting related resources
- Managing an ordered list automatically
Skill Level Beginner
PHP with MySQL Beyond the Basicswith Kevin Skoglund10h 26m Intermediate
MVC Frameworks for Building PHP Web Applicationswith Drew Falkman2h 57m Intermediate
1. Create a Content Management System
2. Build Dynamic Content Navigation
3. Use Context and Options
4. Cookies and Sessions
5. Regulate Page Access
6. Nesting Related Resources
Next steps1m 15s
- 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.