2015-09-05, 08:05 PM
2015-09-05, 08:37 PM
$countadmins = $db->write_query( "SELECT COUNT(*) AS totaladmins FROM ".TABLE_PREFIX."users WHERE `usergroup` = 4 " );
$totaladmins = my_number_format($db->fetch_field($countadmins, "totaladmins"));
If you add this somewhere in your index.php file, you can then echo the variable {$totaladmins} in one of the index templates, for example index_stats
it will show how many users there are in the group 4 (admin).
2015-09-05, 09:29 PM
(2015-09-05, 08:37 PM)Sazze Wrote: [ -> ]$countadmins = $db->write_query( "SELECT COUNT(*) AS totaladmins FROM ".TABLE_PREFIX."users WHERE `usergroup` = 4 " ); $totaladmins = my_number_format($db->fetch_field($countadmins, "totaladmins"));
If you add this somewhere in your index.php file, you can then echo the variable {$totaladmins} in one of the index templates, for example index_stats
it will show how many users there are in the group 4 (admin).
thank you its work but I want to show total admin and moderator not only one group
2015-09-05, 10:31 PM
how about
$query = $db->query('
SELECT COUNT(uid) AS team_count FROM '.TABLE_PREFIX.'users WHERE usergroup IN
(SELECT gid FROM '.TABLE_PREFIX.'usergroups WHERE cancp=1 OR issupermod=1 OR canmodcp=1)
');
$team_count = $db->fetch_field($query, 'team_count', 1);
2015-09-06, 12:58 PM
thank you!
<?php
$countadmins = $db->write_query( "SELECT COUNT(*) AS totaladmins FROM ".TABLE_PREFIX."users WHERE `usergroup` = 4 " );
$totaladmins = my_number_format($db->fetch_field($countadmins, "totaladmins"));
$countadmins2 = $db->write_query( "SELECT COUNT(*) AS totaladmins2 FROM ".TABLE_PREFIX."users WHERE `usergroup` = 8 " );
$totaladmins2 = my_number_format($db->fetch_field($countadmins2, "totaladmins2"));
$countadmins3 = $db->write_query( "SELECT COUNT(*) AS totaladmins3 FROM ".TABLE_PREFIX."users WHERE `usergroup` = 9 " );
$totaladmins3 = my_number_format($db->fetch_field($countadmins3, "totaladmins3"));
$toplamad = $totaladmins + $totaladmins2 + $totaladmins3;
echo "<b>" . $toplamad . "</b>";
?>