Welcome Guest, Not a member yet? Register   Sign In
Only display populated categories
#1

[eluser]chipp[/eluser]
Hello CI Friends,

I am working on a project in which I am displaying a list of categories. The categories have items assigned to them.

My Tables:
--------------
Category
--------------
cat_id (PK)
cat_title
--------------

--------------
Item
--------------
item_id (PK)
item_title
cat_id (FK)
--------------

Currently I have a MODEL function (fetch_categories)that retrieves all categories. This is passed to my view from my controller and displays a list of the results. This displays all categories regardless of item assignment.

I would like to modify this to only display categories that have items assigned.

My Question:
How do I validate that categories have items assigned to them and only display these results?

Thank you in advance for any response you may have.


Messages In This Thread
Only display populated categories - by El Forum - 05-04-2012, 07:51 AM
Only display populated categories - by El Forum - 05-04-2012, 08:01 AM
Only display populated categories - by El Forum - 05-04-2012, 08:07 AM
Only display populated categories - by El Forum - 05-04-2012, 08:29 AM
Only display populated categories - by El Forum - 05-04-2012, 09:03 AM
Only display populated categories - by El Forum - 05-04-2012, 09:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB