[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
Here is the SQL:
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...
$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");
I don't know if it's possible to even do what I'm trying to do here with the way the search is.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)