Counting number of instances of a specific value

Erik-74

New Member
Hello all,

Could use some help getting this to work. Thought I was om the right track, but might be mistaking.

In form 'melden' there's a dropdown element ('provincie') with 12 options in it. What I need is a overview of all 12 options and the number of times a specific value was selected. I do not want this to be done in a filtered list view, but in a form view.

So I made a second form (and table) called 'total'. In this form there are 12 calc elements with the following ('Drenthe') being 1 of the 12 options):

$db =& JFactory::getDBO();
$query = "SELECT COUNT(*) FROM `melden` WHERE `provincie` = 'Drenthe'";
$db->setQuery($query);
return $db->loadResult();

In form view all totals keep showing with value '0'. Where am I going wrong?

Thanx for helping out!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top