2017-12-06, 12:19 AM
I'm trying to pull counts from a specific usergroup that counts the sex of the users in that group.
As of right now it's pulling counts from the entire forum instead of just that usergroup.
I tried adding in a where clause as suggested by someone else to pull from a usergroup but now I just keep running into SQL errors and the page won't even load.
I'm lost, and if someone could point me in the right direction on how to count these variables just for usergroup 4 that would be lovely.
Thanks
As of right now it's pulling counts from the entire forum instead of just that usergroup.
$num_male = $db->fetch_field($db->simple_select("userfields", "COUNT(ufid) as count", "fid3='Male'"), "count");
$num_female = $db->fetch_field($db->simple_select("userfields", "COUNT(ufid) as count", "fid3='Female'"), "count");
$num_unspecified = $stats_cache['numusers'] - $num_male - $num_female;
I tried adding in a where clause as suggested by someone else to pull from a usergroup but now I just keep running into SQL errors and the page won't even load.
$num_male = $db->fetch_field($db->simple_select("userfields", "COUNT(ufid) as count", "WHERE usergroup IN ('4')", "fid3='Male'"), "count");
$num_female = $db->fetch_field($db->simple_select("userfields", "COUNT(ufid) as count", "WHERE usergroup IN ('4')", "fid3='Female'"), "count");
$num_other = $db->fetch_field($db->simple_select("userfields", "COUNT(ufid) as count", "WHERE usergroup IN ('4')", "fid3='Other'"), "count");
I'm lost, and if someone could point me in the right direction on how to count these variables just for usergroup 4 that would be lovely.
Thanks