Prev | Current Page 211 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

product_id, p.name
FROM product_category pc
INNER JOIN product p
ON p.product_id = pc.product_id
WHERE pc.category_id = 5;
Showing Products Page by Page
If certain web sections need to list large numbers of products, it??™s useful to let the visitor browse
them page by page, with a predefined (or configurable by the visitor) number of products per page.
Depending on the tier on your architecture where paging is performed, there are three
main ways to implement paging:
Paging at the data tier level: In this case, the database returns only a single page of products,
the page needed by the presentation tier.
Paging at the business tier level: The business tier requests the complete page of products
from the database, performs filtering, and returns to the presentation tier only the page of
products that needs to be displayed.
Paging at the presentation tier level: In this scenario, the presentation tier receives the complete
list of products and extracts only the page that needs to be displayed for the visitor.
Paging at the business tier and presentation tier levels has potential performance problems,
especially when dealing with large result sets, because they imply transferring unnecessarily
large quantities of data from the database to the presentation tier. Additional data also needs
to be stored on the server??™s memory, unnecessarily consuming server resources.


Pages:
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223