Add Page number to website for Product page?

By raj1225 ·
Hi there,
i am designing my own site. i was stuck with product page.
i need to add page number for product page.
i have more number of product. i want to use page number to show the list of product. i need to display 5 item per page. i want link prev and next alone.
i am using html, js, css and mysql.
please show me a example with code.
With regards,

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

MySQL Queries and PHP...

by Sven2157 In reply to Add Page number to websit ...

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.


Collapse -

Reponse To Answer

by jqbecker In reply to MySQL Queries and PHP...

I'm with you. Too many folks in these forums wont do the bare minimum to find answers themselves, they just want a complete program handed to them.

Related Discussions

Related Forums