Questions

Answer for:

Add Page number to website for Product page?

Message 2 of 3

View entire thread
+
1 Votes
Sven2157

What you seek is not as simple as it would seem. If you took the time to Google this, instead of posting a generic question, with a request for code, you are most likely not going to learn from; rather copy and paste, then you would have found many, many examples.

However, if you would like to actually learn this, then you need to focus on a more dynamic language for your shopping cart. I suggest PHP, as it is the easiest to use. When creating pages of product, you must query the database for ALL products. When the query returns, you have a 'results' number( i.e. the total amount of products in the DB ). This is used to calculate the total number of pages that will be needed.

To display five results on the page, another query of the database is needed, but with a LIMIT of five. Your 'next' button, would then be the same query, plus five. This then lists the next five, while your 'previous' button is the same, but minus five.

As you can see this gets pretty complicated, pretty fast.

See the following links:

PHP Pagination
W3 Schools PHP

... Start there, and if you have specific questions about PHP or Pagination, then post what you are not understanding.

Sven2157