repeat products inside a repeat categories
Hi. I must be tired as I am sure I done this before but for the life of me I cannot get it this process to work...
(this is not an ecommerce website with URLs, just a simple page showing typs of products).
In the database I have two tables:
Products:
ProductsID
ProductsName
ProductsLink (this stores a value from the categories table)
Categories
CategoriesID
CategoriesName
CategoriesPhoto
I have set up a page where there are 6 product categories and they all display on screen using a regular repeat region.
Now under each of those categoies I wanted to display all products relating to that categories.
I have tried many different recordsets using different JOIN methods etc and just cannot get it to work.
Just wanted to know what im missing :(
Here are some code snippets
"SELECT * FROM categories INNER JOIN products ON products.ProductsLink = categories.CategoriesID"
.........................................................................
<?php
$row_count=1;
?>
<?php do { ?>
<div class="product"<?php echo(($row_count%3==0)?' style="margin-right=0;"':' style="margin-right:22px"'); ?>>
<div class="prod-hdr">
<p><?php echo $row_rsProducts['CategoriesName']; ?></p>
</div>
<div class="prod-img"><img src="photos/<?php echo $row_rsProducts['CategoriesPhoto']; ?>" alt="cookshop and kitchenware products" width="278" height="186"></div>
<div class="prod-itm">
<ul>
<li><?php echo $row_rsProducts['ProductsName']; ?></li>
</ul>
</div>
</div>
<?php
$row_count++;
?>
<?php } while ($row_rsProducts = mysql_fetch_assoc($rsProducts)); ?>