From the course: PHP: Object-Oriented Programming with Databases
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Numbered page links - PHP Tutorial
From the course: PHP: Object-Oriented Programming with Databases
Numbered page links
- [Instructor] In addition to having previous and next page links, it's very common if we have a lot of results to have numbered pages as well. So we can jump directly to the page that we want instead of having to page through each one of the pages in sequence to get to the results we want. In this movie, we're going to learn how to create those links. I'm going to put my numbered links in between my previous and next link just like we saw with Google, right? Google has all the Os in their name and they have previous and next links on either side. That's the idea here. So we want to make a loop. So what is our loop going to be? We want it to be from one all the way up to the total number of pages. So let's write a loop that does that. We can do that with a for loop, for i equal to one. So it's going to start out being initialized at one. And while i is less than or equal to pagination total pages. So while it's less than or equal to the number of total pages, let's keep going through…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.