11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.it-ebooks.infoCHAPTER 35 • PRACTICAL DATABASE QUERIES• Number of entries per page: This value is entirely up to you. Alternatively, youcould easily offer the user the ability to customize this variable. This value ispassed into the number_rows component of the LIMIT clause.• Row offset: This value depends on what page is presently loaded. This value ispassed by way of the URL so that it can be passed to the offset component of theLIMIT clause. You’ll see how to calculate this value in the following code.• Total number of rows in the result set: You must specify this value because it isused to determine whether the page needs to contain a next link.Interestingly, no modifications to the <strong>MySQL</strong> database class are required. Because this conceptseems to cause quite a bit of confusion, the code is reviewed first, and then the example is presented inits entirety in Listing 35-4. To begin, connect to the <strong>MySQL</strong> database and set the number of entries thatshould appear per page, as shown:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!