How I can foreach array properly?
Code:
while ($row = mysqli_fetch_assoc($result))
{
if ($use_sef_links == true)
{
$sef_link = "{$row['title']} ({$row['home_team_name']} vs {$row['away_team_name']}) {$row['dt']}";
$sef_link = str_replace("-", " ", $sef_link);
$sef_link = preg_replace('#\s{1,}#', " ", $sef_link);
$sef_link = str_replace(" ", "-", $sef_link);
$sef_link = preg_replace('#[^a-zA-Z0-9-]#', "", $sef_link);
$sef_link .= '_m'. $row['id'] . '.html';
$row['link'] = $sef_link;
}
else
{
$row['link'] = 'match.php?id=' . $row['id'];
}
$matches[$row['season_name']][$row['game_day']][] = $row;
}
foreach ($matches as $match) { ?>
<section class="kode-pagesection margin-bottom-40" style="padding-top: 120px;">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="kode-section-title"> <h2>Coming <?php echo $match['season_name']; ?> season game - <?php echo $match['game_day']; ?> gameday</h2> </div>
<div class="kode-fixer-list">
<ul class="table-head thbg-color">
<li> <h5>Coming games</h5></li>
<li> <h5>Game starts</h5> </li>
<li> <h5>Stadium</h5> </li>
<li> </li>
</ul>
<ul class="table-body">
<li>
<a href="#" class="list-thumb"><img src="<?php echo $match['home_team_logo']; ?>" class="circle-icon" style="height:50px; width:50px;" alt="<?php echo $match['home_team_name']; ?>"> <?php echo $match['home_team_name']; ?></a>
<span>VS</span>
<a href="#" class="list-thumb"><img src="<?php echo $match['away_team_logo']; ?>" class="circle-icon" style="height:50px; width:50px;" alt="<?php echo $match['away_team_name']; ?>"> <?php echo $match['away_team_name']; ?></a>
</li>
<li><small><?php echo $match['dt']; ?></small></li>
<li><small><?php echo $match['stadium']; ?></small></li>
<li class="fixer-btn">
<a href="<?php echo $match['link']; ?>"><?php echo $label_array[103]; ?></a>
</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<?php } ?>
If I just print_r($matches); then I can see all seasons and games.. But I cant foreach matches as match..
I put image here to show what it shows if I print matches string.