<div class="panel-body"> <div class="col-xs-offset-1 col-xs-10"> <table class="table"> <thead> <tr> <th>Rank</th> <th colspan="2">Superhero</th> <th>Total Score</th> </tr> </thead> <tbody> <?php $count = 1; foreach ($powers as $power) { $superhero = Superhero::findByPowerId($power[1]); if ($count == 1) { echo "<tr class='danger rank1'>"; } else { echo "<tr>"; } echo "<td class='col-xs-2'>#" . $count . "</td>"; echo "<td class='col-xs-2'>"; echo "<a href='#' id='" . $superhero->getId() . "' onclick='sendSuperheroID(this.id)'>"; echo "<img src='" . $superhero->getImageUrl() . "'>"; echo "</a>"; echo "</td>"; echo "<td><a href='#' id='" . $superhero->getId() . "' onclick='sendSuperheroID(this.id)'>Superman</a></td>"; echo "<td class='col-xs-2'>" . substr($power[0], 0, 3) . "</td>"; echo "</tr>"; }