Hi,

I have a piece of code that queries a list of categories for a shopping cart. In the code, I have the link setup something like this:

<a href="product-detail.php?ProductID=1000>category name</a>

The problem is that no matter what category name:

Furniture
Arts / Crafts etc, it will always display that same product '1000', what I would like to do is be able to point to a different item, within in the specific category if possible so the result would be something like this:

<a href="product-detail.php?ProductID=1000>Furniture</a>
<a href="product-detail.php?ProductID=2000>Arts / Crafts</a>
<a href="product-detail.php?ProductID=3000>Coffee</a>

is this possible?

here is query I am using:

$query = "SELECT ProductCategory,ProductSubCategory
FROM $table_pro
WHERE ProductCategory = '$ProductCategory'
Group BY ProductSubCategory";

Any suggestions appreciated,

Thanks,

Brett

    Why are you passing "ProductID"
    and searching for "ProductCategory"?

      Hi,

      What I am doing is, when someone clicks on one of the categories, they are brought to the product detail page. I put in ProductID to bring up a product.

      here is the example:

      http://www.northwoodsliving.com/version2/shopping/homedecor/index.php?PageID=HomeDecor&ProductCategory=Home%20Decor

      The ProductCategory is to bring up the names of the categories and list them on the page.

      I would love to be able to ramdomly choose an item from each category, I just don't know how to point to a product other than ProductID=1000/

      Thanks

      Brett

        Not too sure if this was the most effecient, but it works. I just incerted a random query:

        echo"product-detail.php?ProductID="
        $query = "SELECT ProductID,
        {Random}
        FROM Products
        WHERE ProductSubCategory = '$ProductSubCategory'
        ORDER BY Ramdom
        LIMIT 1";
        echo"$ProductID";
        echo"rest of links";

          Write a Reply...