I have login data that is stored in a MySQL database. From that data I was successfully able to group the logins every month organized by gender. For example, in January 1400 male users and 1500 female users logged in.
Now I'm struggling to display the data in a table.
Currently, I have it set up like this:
<div role="tabpanel" class="tab-pane fade active in" id="tab_content1" aria-labelledby="home-tab">
<table id="datatable-fixed-header" class="table table-striped table-bordered">
<thead>
<tr>
<th>Month</th>
<th>Male Logins</th>
<th>Female Logins</th>
</tr>
</thead>
<tbody>
<?php
foreach ($maleLogin as $maleLog){
$mthDateTime = DateTime::createFromFormat('n', $maleLog->month);
foreach ($femaleLogin as $femaleLog) {
?>
<tr>
<td><?php echo $mthDateTime->format('F').' '.$maleLog->year; ?></td>
<td><?php echo $maleLog->count;?></td>
<td><?php echo $femaleLog->count;?></td>
</tr>
<?php } }?>
</tbody>
</table>
</div>
The problem is with my nested for loop. Currently, it displays the data like so.