12-02-2017, 01:35 AM
I went to add a counter for "Males, Females and Unspecified".
Upon doing such the page is now counting but the only two that are being counted correctly is Male and Unspecified.
Females count as two when there is only one. And unspecified, while showing the correct amount puts a negative sign in front of the count.
This is the code:
I think I've figured out the possible issue but I do not know a way to fix this or how to pull just specifics.
This seems to be pulling the count of Females/Males for the entire community instead of just this usergroup (hence why females is coming as a negative number, I'm believing since some accounts aren't completely filled out yet)! How would I go about just pulling for this usergroup (#8)?
I believe I'd need to gather the data from usergroup 8 but I'm unsure how to do that to then gather the above information from just that group.
Upon doing such the page is now counting but the only two that are being counted correctly is Male and Unspecified.
Females count as two when there is only one. And unspecified, while showing the correct amount puts a negative sign in front of the count.
This is the code:
PHP Code:
$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;
Code:
<table border="0" cellspacing="'.$theme['borderwidth'].'" cellpadding="'.$theme['tablespace'].'" class="tborder" style="text-align: center;">
<tbody>
<tr>
<td class="tcat" width="33.3%">{$num_male} Males</td>
<td class="tcat" width="33.3%">{$num_female} Females</td>
<td class="tcat" width="33.3%">{$num_unspecified} Unspecified</td>
</tr>
</tbody>
</table>
I think I've figured out the possible issue but I do not know a way to fix this or how to pull just specifics.
This seems to be pulling the count of Females/Males for the entire community instead of just this usergroup (hence why females is coming as a negative number, I'm believing since some accounts aren't completely filled out yet)! How would I go about just pulling for this usergroup (#8)?
I believe I'd need to gather the data from usergroup 8 but I'm unsure how to do that to then gather the above information from just that group.