Use SQL COUNT to more efficiently find the count of the number of pages that belong to each subject.
- [Instructor] In this movie,…we're going to learn to add a page count…to each one of our subjects.…We already learned how to count records…in a result set before.…We had find pages by subject ID to get a page set back,…and then we called mysqli_num_rows on that page set.…It will tell us how many rows there are.…That will give us our page count,…so we know how many there are…and then we can free up the result.…We now have a count that we can use.…We're already doing this type of counting…on our new .php and edit.php pages…when we list the form options for position.…
We only have number of positions available…that we have the number of subjects or pages.…Now in that case, it worked well enough.…It makes one SQL request,…and it counts the rows in the result.…The database is returning a lot of extra data for each row,…that we're then discarding,…but that inefficiency won't really even be noticeable.…However, what if we want to count the pages…for each one of these subjects?…Suddenly now, we're doing four times the work,…
- 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.