Results 1 to 2 of 2

Thread: [RESOLVED] Unique Pagination Issue

  1. #1
    Join Date
    Apr 2009

    resolved [RESOLVED] Unique Pagination Issue

    I've got a website with a catalog of products that are displayed through pagination. It takes the limit and offset, and applies it to the search. The issue is that it's searching two tables, one is a table of the products and the other is a table of the categories. Because products can be listed in the subcategories table multiple times due to the fact that they can be assigned to multiple sub categories, I'm getting the products repeating themselves across the various pages.

    Here are the two tables being searched with fields:

    id, sub_category, product_id

    id, product_name

    Here is the SQL:

    HTML Code:
    $query = mysql_query("SELECT sub_categories.product_id, products.product_name FROM sub_categories, products WHERE sub_categories.sub_category = '$sub_category' AND sub_categories.product_id = products.id GROUP by sub_categories.product_id ORDER BY products.product_name ASC LIMIT $offset, $rowsperpage");
    What this produces is page 1 with all the correct products displayed as they should, then page 2 has one or two of the products from page 1 on it, along with others, and then so on with page 3, etc...

    I don't know if it's possible to even do what I'm trying to do here with the way the search is.

    Any suggestions?

  2. #2
    Join Date
    Nov 2006

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center