OK , I have an interesting question. I hope that there is an easy answer, otherwise I will have to create a very complex function to handle this.
PROBLEM:
I have a script that I got off of this site that has helped me out TREMENDOUSLY, but I have hit a brick wall. The script is calling for an array. Which is fine. This i how I HAVE been passing values to it:
$data = array("Item1"=>$count1, "Item2" =>$count2, .....);
This was for STATIC variables and stuff I know will never change. NOW I am needing something a little more dynamic. I was hoping to get an array from my MYSQL Database. The arrays are absically the same I presume, but I hit a snag. How can I COUNT the number of values in the array.
I have two tables that are involved:
Member Table
member_id, profession_id, member_name
Professions Table
profession_id, profession_name
The query will pull the member_id and the profession_id and then I store it in an array. Now if I was pulling ONE profession, that would be great, becasue I would just use the MYSQL_NUM_ROWS Function to get how many of a given profession I have.
BUT NOW I need to know how many members I have of EACH profession.
QUESTION
Is there a way I can get the SUM of alike values in the Array? OR is there a better way for me to do this? I am hoping that there is a function that will do this for me, but I have looked without success.
Any Help would be appreciated. Sorry this was so long-winded.
-Happy Holidays!