hi all

i have 5 categories in "category table". with 2 fields
"category_id" and "category_name".
Code:
1. Adidas
2. Reebok
etc
i have 10 sub categories in "sub categories" table with 2 fields
"sub_category_id" and "sub_category_name".

Code:
1. Shoes
2. Tshirts
etc
There are "category_id" and "sub_category_id" fields in the "product table" also.

i m showing these sub categories in the <select>drop down on my product pages
PHP Code:
<select name="sub_category">
$qry="select * from sub_categories";
$result=mysql_query($qry);
while(
$row=mysql_fetch_array($result))
{
echo 
"<option value='1'>$row['sub_category_name']</option>
}
</select> 
When sub category "shoes" is selected from drop down, then all shoes are displayed fine.
PHP Code:
qry "select * from product_table where category_id=1 and sub_category = 1" 

But i want if there is no products for sub category "shoes" then this sub category "shoes" should not be displayed in the drop down.

vineet