I have two tables I am trying to pull data from. The first table holds "groups" and the other table "group_memb ers" holds the members of that group with a respective id that points to id in "groups".
I need to count the number of members (rows.. each row represents one membership) from group members, and print the 10 most populus groups with their total members.
this is what i have for a query, but then i do not know how to fetch the array... I can't think right now either because i have been staring at this for hours!!
here is my query:
thanks for the help!!
I need to count the number of members (rows.. each row represents one membership) from group members, and print the 10 most populus groups with their total members.
this is what i have for a query, but then i do not know how to fetch the array... I can't think right now either because i have been staring at this for hours!!
here is my query:
Code:
$sql="SELECT group_id, count(*) as a FROM group_friends GROUP BY group_id ORDER BY COUNT(*) DESC";
$res=mysql_query($sql)
while($data=mysql_fetch_array($res)) {
print data...
}
Comment