CREATING A DYNAMIC ONLINE GALLERY (Managed web hosting) 4. You now
CREATING A DYNAMIC ONLINE GALLERY 4. You now have all the information that you need to calculate the start row, and to build the SQL query to retrieve a subset of records. Add the following code immediately after the code in the preceding step: // calculate the start row of the subset $startRow = $curPage * SHOWMAX; The original SQL query should now be on the next line. Amend it like this: // prepare SQL to retrieve subset of image details $sql = “SELECT * FROM images LIMIT $startRow,”.SHOWMAX; Notice that I ve used double quotes this time, because I want PHP to process $startRow. Unlike variables, constants aren t processed inside double-quoted strings. So SHOWMAX is added to the end of the SQL query with the concatenation operator (a period). The comma inside the clos- ing quotes is part of the SQL, separating the two arguments of the LIMIT clause. 5. Save the page and reload it into a browser. Instead of eight thumbnails, you should see just six, as shown here: 12 Change the value of SHOWMAX to see a different number of thumbnails. The text above the thumbnail grid doesn t update because it s still hard-coded, so let s fix that. 6. Locate the following line of code in the main body of the page:
Displaying 1 to 6 of 8
335
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.