Hello there,
I'm new to Joomla coding.....new to php and mysql. I come from a more creative perspective but in creating a site for a client I realized that I needed to implement a solution that isn't out there yet.
I've done a lot of seaching but some of the articles in the Joomla forum indexed by Google don't seem to be there anymore (maybe after the forum change?).
I could really use some help on a basic task here....The quick question is, how do I set up the database query to determine the number of articles or content items in a particular category?
I'm using Joomla 1.0.x and the code will be running in a mambot if any of that matters.
I could really use the help. Thanks.
Regards,
Steve
Help finding the number of content items in a category
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
Re: Help finding the number of content items in a category
For the number of content items in a category, you will need to join the two tables by pairing up their columns in common: the foreign key 'catid' in the content table and the primary key 'id' of the category table.
use this:
or if you want to get details on the content items:
Hope that helps.
use this:
Code: Select all
SELECT count(c.id) FROM #__content c
INNER JOIN #__categories AS cat ON cat.id = c.catid
WHERE cat.title = 'Languages'
Code: Select all
SELECT c.id, c.title, c.sectionid, cat.id FROM #__content c
INNER JOIN #__categories AS cat ON cat.id = c.catid
WHERE cat.title = 'Languages'