Jump to the post that solved this thread.
Solved: 7 Years, 11 Months ago Total Members of a group.
#1
Solved: 7 Years, 11 Months ago
So I've been working on this but it doesn't come out correctly so I'll see if someone can help.
In a forums statistics you can view the total amount of members like such.

[Image: 7debf218fda645b778d9218e582d71ac.png]

I want to display the total members of a specific group on the forums.
i.e I want to display the total number of members in the Admin group on the public forums.

I want it to automatically increase obviously.
The signature does not exisit.
Reply
#2
Solved: 7 Years, 11 Months ago
Just run a query that counts the users in the group.
Reply
#3
Solved: 7 Years, 11 Months ago
This user has been denied support. This user has been denied support.
I know it shows up in the cap I can probably make a quick script for you to use. Feel free to add me on Skype (same as forum name).
Skype: Mikeorman
Reply
#4
Solved: 7 Years, 11 Months ago
$count = $db->fetch_field( $db->query( "SELECT COUNT(*) as numberofmembers FROM ".TABLE_PREFIX."users WHERE `usergroup` = {Usergroup} ), 'numberofmembers' );

Not my query, credits to Cedric
Reply
#5
Solved: 7 Years, 11 Months ago
(2015-06-21, 08:53 AM)Akay Wrote:
$count = $db->fetch_field( $db->query( "SELECT COUNT(*) as numberofmembers FROM ".TABLE_PREFIX."users WHERE `usergroup` = {$usergroup} ), 'numberofmembers' );

Not my query, credits to Cedric

Small error, {Usergroup} must be {$usergroup}, where:

$usergroup = 4;

for admins.
Regards, Ad Bakker (NL)
Reply
#6
Solved: 7 Years, 11 Months ago
I've been awake almost 2 days now and can hardly funcation. 

1. It's for clients
2. Group ID is 8

Anyways if anyone has an idea to the query can you post it here and I'll make some changes. My heads fried and I'm gonna bed.
The signature does not exisit.
Reply
#7
Solved: 7 Years, 11 Months ago
(2015-06-21, 05:02 PM)Nasyr Wrote: I've been awake almost 2 days now and can hardly funcation. 

1. It's for clients
2. Group ID is 8

Anyways if anyone has an idea to the query can you post it here and I'll make some changes. My heads fried and I'm gonna bed.

Post your current code you have in the PHP file.
Reply
#8
Solved: 7 Years, 11 Months ago
I think that Akay's statement is correct, for usergroup 8 it is then:


$count = $db->fetch_field( $db->query( "SELECT COUNT(*) as numberofmembers FROM ".TABLE_PREFIX."users WHERE `usergroup` = 8 "), 'numberofmembers' ); 

Where I had to correct another small typing error by adding a double quote just after the 8 of the usergroup.
Regards, Ad Bakker (NL)
Reply
#9
Solved: 7 Years, 11 Months ago
(2015-06-22, 12:03 PM)Ad Bakker Wrote: I think that Akay's statement is correct, for usergroup 8 it is then:


$count = $db->fetch_field( $db->query( "SELECT COUNT(*) as numberofmembers FROM ".TABLE_PREFIX."users WHERE `usergroup` = 8 "), 'numberofmembers' ); 

Where I had to correct another small typing error by adding a double quote just after the 8 of the usergroup.

Does anyone know how to do this with additional usergroups as well?
> SELECT finger FROM hand WHERE id='3'
Reply
#10
Solved: 7 Years, 11 Months ago
(2015-06-22, 12:03 PM)Ad Bakker Wrote: I think that Akay's statement is correct, for usergroup 8 it is then:


$count = $db->fetch_field( $db->query( "SELECT COUNT(*) as numberofmembers FROM ".TABLE_PREFIX."users WHERE `usergroup` = 8 "), 'numberofmembers' ); 

Where I had to correct another small typing error by adding a double quote just after the 8 of the usergroup.

usergroup = 8 count Number of user in gid 8 only. can I count all of gid ?
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)