View Full Version : Query to print count user from usergroup
Muhammad Rahman
11-14-2014, 04:20 AM
like thread title,
anyone know query to display count user from usergroup.
vBNinja
11-14-2014, 05:28 AM
SELECT COUNT(userid) amount
FROM user
WHERE usergroupid = X OR FIND_IN_SET(X, membergroupids);
Change "X" to the usergroup ID you need
Muhammad Rahman
11-15-2014, 06:26 AM
SELECT COUNT(userid) amount
FROM user
WHERE usergroupid = X OR FIND_IN_SET(X, membergroupids);
Change "X" to the usergroup ID you need
not working, only display "Array" ..
this my code, whats wrong
$usg = $vbulletin->db->query_first("SELECT COUNT(userid) amount
FROM " . TABLE_PREFIX . "user
WHERE usergroupid = 6 OR FIND_IN_SET(6, membergroupids)");
$templater = vB_Template::create('usg_temp');
$templater->register('usg', $usg);
$usg_display .= $templater->render();
$template_hook[forumhome_above_forums] .= $usg_display;
mokujin
11-15-2014, 08:09 AM
Use {vb:raw usg.amount} in your template? :D
Muhammad Rahman
11-15-2014, 09:27 AM
Use {vb:raw usg.amount} in your template? :D
oh snap!! fixed, thanks very much :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.