Re: Re: [Jason] showing record count
2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 1, 2021 (RSS)
By HDLLC - February 25, 2021
In response to: https://www.interactivetools.com/forum/forum-posts.php?postNum=2214836#post2214836
In response to that post - I cannot seem to wrap my head around getting this to work in my case.
I want to be able to grab a count of the number of records that are assigned values.
For instance, my table is: project_management (that's the top level cms section).
Inside that - I have a field of "current_owner".
There's a list of possible selections a person can assign a project to - names of my team.
I just wanted to drop some numbers so, at a glance, I can see how many projects are in each person's cue.
(echo number of records where "jeff" is the value in field "current_owner" for instance.)
And then I can pull for each team member after that.
I can't seem to wrap my head around this solution.
Thanks, in advance, for any help!
--JH
By Jenna - March 1, 2021
Hi JH,
In this case you could use the `mysql_count` function ( mysql_count($tableName, $whereEtc) ). Used in the below format:
$jeffCount = mysql_count('project_management', "`current_owner` = 'jeff'");
This would return a count for every project associated with Jeff's name. If you needed to filter by other parameters (like project_status = 'active' for example) you could add that to the second part, setting it up like a where clause concatenating with AND/OR etc.
Please let me know if this helps you at all for your situation.
interactivetools.com