Display loop list where not empty
<p>I have a list of categories and want to display them if they are not empty, as in a product is listed in the category. How would I do this?
Code as is.</p>

<pre><code>$category_sql = "SELECT * FROM tm_product_category";
$category_query = mysql_query($category_sql) or die(mysql_error());
$categorylist = mysql_fetch_assoc($category_query); 


&lt;?php do { ?&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="category.php?pk_cat_id=&lt;?php echo $categorylist['pk_cat_id'];?&gt;"&gt;&lt;?php echo $categorylist['category']; ?&gt;&lt;/a&gt;&lt;/ul&gt;
&lt;?php } while ($categorylist = mysql_fetch_assoc($category_query)); ?&gt;
</code></pre>

<p>I have one table with a list of categories and id's and another table with products and foreign key category id's.</p>

<p>Thanks.</p>
