PHP SOLUTIONS: DYNAMIC WEB DESIGN (Web site optimization) MADE EASY Replace
PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY Replace it with this:
Displaying
Let s take this line by line. The value of $startRow is zero-based, so you need to add 1 to get a more user-friendly number. So, $startRow+1 displays 1 on the first page and 7 on the second page. In the second line, $startRow+1 is compared with the total number of records. If it s less, that means the current page is displaying a range of records, so the third line displays the text to with a space on either side. You then need to work out the top number of the range, so a nested if… else conditional statement adds the value of the start row to the maximum number of records to be shown on a page. If the result is less than the total number of records, $startRow+SHOWMAX gives you the number of the last record on the page. However, if it s equal to or greater than the total, you display $totalPix instead. Finally, you come out of both conditional statements and display of followed by the total number of records. 7. Save the page and reload it in a browser. You still get only the first subset of thumbnails, but you should see the second number change dynamically whenever you alter the value of SHOWMAX. Check your code, if necessary, against gallery_mysql07.php, gallery_mysqli07.php, or gallery_pdo07.php. Navigating through subsets of records As I mentioned in step 3 of the preceding section, the value of the required page is passed to the PHP script through a query string. When the page first loads, there is no query string, so the value of $curPage is set to 0. Although a query string is generated when you click a thumbnail to display a different image, it includes only the filename of the main image, so the original subset of thumbnails remains unchanged. To display the next subset, you need to create a link that increases the value of $curPage by 1. It follows, therefore, that to return to the previous subset, you need another link that reduces the value of $curPage by 1. That s simple enough, but you also need to make sure that these links are displayed only when there is a valid subset to navigate to. For instance, there s no point in displaying a back link on the first page, because there isn t a previous subset. Similarly, you shouldn t
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.