MyBB Community Forums

Full Version: Incorrect Counts Pulled
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Thanks to SvePu, I have been able to create a page that will pull up users in a specific group and display whether their account is female/male (if specified).

However, 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:
    $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;
        <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>

Screenshot attached below.

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! How would I go about just pulling for this usergroup (#8)?
Just bumping this to see if anyone can still answer this. Basically I’m unsure how to do this for a specific usergroup.