I'm extracting data from two different API calls and displaying in a column.
The first loop (images column) is calling the JSON data from API and displaying images in first column, the second loop (other column) is displaying user number of battles data in remaining columns, like so:
Currently it looks like this:
| images | other |
|__________|_________|
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| | 1 |
| | 2 |
| | 3 |
| | 4 |
| | 5 |
| | 6 |
| | 7 |
| | 8 |
|__________|_________|
What I want to accomplish is this:
| images | other |
|__________|_________|
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 | 7 |
| 8 | 8 |
|__________|_________|
Here is my code (I left the API calls at top etc)
<table class="table table-sm">
<thead class="thead-dark">
<tr>
<th>Tank</th>
<th>Battles</th>
<th>Wins</th>
<th>Losses</th>
<th>Kills</th>
<th>Mastery class</th>
<th>Survived matches</th>
<th>XP gained</th>
</tr>
</thead>
<tbody>
<?php foreach ($tanks['data'] as $key => $value) { ?>
<tr>
<td><?php echo '<img src="'.$value['images']['big_icon'].'"/>'; ?> </td>
<?php } ?>
<?php foreach ($tanks_stats['data']['1076056102'] as $key => $value) { ?>
<td><?php echo $value['all']['battles']; ?> </td>
<td><?php echo $value['all']['wins']; ?> </td>
<td><?php echo $value['all']['losses']; ?> </td>
<td><?php echo $value['all']['frags']; ?> </td>
<td><?php echo $value['mark_of_mastery']; ?> </td>
<td><?php echo $value['all']['survived_battles']; ?> </td>
<td><?php echo number_format($value['all']['xp']); ?> </td>
</tr>
<?php } ?>
</tbody>
</table>
At the moment, it displays all the tank images in the first column, then the remaining data is displayed AFTER all the tank images have populated.
What I am trying to do is get the images in first column to display next to the data column. The problem i'm having is because they are two different API calls I can't get them in same loop.