How to fetching multiple data from database

Please help, I’m trying to fetch two tables using this code

<?php
    ///POST ACTION TO GET TO NUMBER OF STUDENTS IN SSS3 CLASS
    
$query = " SELECT * FROM `students` WHERE `gender` = 'Male' AND `class` = 'SSS3' ";
$run_query = mysqli_query($connection, $query);
$total_sss3_male = mysqli_num_rows($run_query);

$query = " SELECT * FROM `students` WHERE `gender` = 'Female' AND `class` = 'SSS3' ";
$run_query = mysqli_query($connection, $query);
$total_sss3_female = mysqli_num_rows($run_query);

$query = " SELECT * FROM `students` WHERE `class` = 'SSS3' ";
$run_query = mysqli_query($connection, $query);
$total_sss3 = mysqli_num_rows($run_query);
?>

And here is the HTML Table code

<tr><td> SSS 3 </td>
            <td><span class="badge bg-important"><?php echo $total_sss3_female; ?></span></td>
            <td><span class="badge bg-important"><?php echo $total_sss3_female; ?></span></td>
            <td><span class="badge bg-important"><?php echo $total_sss3; ?></span></td></tr>

And here is the screenshot

If you aren’t seeing the results you expect then a problem might be that you have

            <td><span class="badge bg-important"><?php echo $total_sss3_female; ?></span></td>

twice when one of them should be $total_sss3_male.