05-04-2012, 07:51 AM
[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.
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.