display a category if it is not empty

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
keyframerlino
Forum Newbie
Posts: 2
Joined: Thu Sep 25, 2008 10:22 pm

display a category if it is not empty

Post by keyframerlino »

Hi. I have a form that is connected and save the data into the database. The form contains a category and subcategory on each main category.
What I want to achieve is for example I have 10 main category and only 7 main category has a product on each subcategory, I want the 3 main category that is empty including each subcategory to hide it. And then when a user add a product in the category that is empty it will automatically displayed in the list item that is shown to the viewers. This means that the 7 categories displayed as a list item will become 8 categories.
Is it possible?

Lino
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: display a category if it is not empty

Post by pickle »

This is not General Discussion. Moved to PHP Theory
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
eivind
Forum Commoner
Posts: 28
Joined: Tue Apr 19, 2011 7:57 am

Re: display a category if it is not empty

Post by eivind »

It's possible for sure, but how you should code it probably differs according to how your data looks like. Could you give an example of how the data source would look like?
Post Reply