Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The PHP code for paging through a recordset that is displaying a small set of records and then giving the user links to go page by page is a little bit complex, but Dreamweaver will help you generate that code very easily. For this demonstration, I'll use a file named tours2.php, which is in the root folder of the current site. This page already has a repeating region that displays the tour packages from the database.
I'll Preview the page in an external browser, copying the file to the server first. In this version of the page, all nine packages are displayed, which means that the user has to scroll quite a bit to see everything. I'm going to add codes so that there only three rows are displayed at a time, and then links are added that the user can use to move through the content. I'll close the browser and return to Dreamweaver. First, I am going to edit the repeating region, so it only displays three rows at a time.
I'll go to the Server Behaviors panel. Here is the repeating region that I added previously. It's labeled Repeat Region for the rsPackages recordset. I'll double-click on the repeat region, and that takes me to the Repeat Region dialog box. I'll change it to only show three records at a time and click OK. I'll save my changes and open the page again in an external browser.
Now, I am only seeing the first three rows in the recordset. The next step is to add hyperlinks that will allow the user to page through the data. So I'll close the browser and return to Dreamweaver again. You can place these links on the page anywhere you want. I am going to place them at the top of the repeat section, after the heading. I'll place the cursor after the text Something for everyone, and press Enter. Then I'll go to the Server Behaviors panel again. I'll click the Plus button, and go to their Recordset Paging section.
You can add four links for Moving To the First Page, the Previous Page, the Next Page, and the Last Page. I'll do these one at a time. I'll choose Move To First Page. The Link list shows you, Create a new link for the word "First," and then a number of existing links. I am going to choose Create a new link for the rsPackages Recordset and click OK. Then I'll click after the link that's been created and press the Spacebar. I'll go back to the Server Behaviors panel.
Once again, I'll choose Recordset Paging and this time choose Move To Previous Page and click OK. I'll click after those links and press the Spacebar again, go to Server Behaviors > Recordset Paging > Move To Next Page, and click OK. I'll click at the end of the links, press the Spacebar one last time, and go through the process again, selecting Server Behaviors > Recordset Paging > Move To Last Page, and I'll click OK. This is just text.
You can change the text however you like, or replace the text with your own images. I'll save the change and go to Live View and click Yes, and Yes, and then in the page, I see my links. If you try to clicking these links in Live View, you won't see any reaction. To really see this work, you must use an external browser. So I'll exit Live View, and go to the external browser. I am using Firefox. I'll make sure I've copied the newest version of the file over to the server, and now I should be able to page through the data by clicking the Next button.
I'll click Next again, I'll click Previous and Previous again, and I can also go to Last and First. So that's how you can add paging to your dynamic display, displaying a limited number of records and adding links that allow the user to move forward and back as needed.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 91091 Viewers
80 Video lessons · 138152 Viewers
59 Video lessons · 56964 Viewers
52 Video lessons · 70598 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.