I want to fill this matrix. It works, but when I try to put more than one result on a single line, only the last one appears. How to correct?
<h1>Mapa</h1>
<?php
$linha=0;
$coluna=0;
//preencher o mapa
//debug($planeta);
$mapa = array();
$linhas = $planeta->count();
$planeta = $planeta->toArray();
debug($planeta);
?>
<table>
<?php
for ($coluna=0;$coluna<=10;$coluna++){
echo "<tr>";
//echo $mapa[$coluna]['x']." | ".$mapa[$coluna]['y']."<br>" ;
$x = (!empty($planeta[$coluna]['coordx'])) ? $x = $planeta[$coluna]['coordx'] : $x = NULL;
$y = (!empty($planeta[$coluna]['coordy'])) ? $y = $planeta[$coluna]['coordx'] : $y = NULL;
for ($linha=0;$linha<=10;$linha++){
//$y = (!empty($planeta[$linha]['coordy'])) ? $y = $planeta[$linha]['coordy'] : $y = NULL;
echo $x." - ".$y." - Coluna ".$coluna."<br>";
if ($linha === $y && $coluna === $x){
echo "<td><a href='planetas/planeta?x=".$coluna."&y=".$linha."'>
<img src='/gm/img/game/planeta.png' height='30px' width='30px'></a>
</td>";
} else {
echo "<td><a href='planetas/planeta?x=".$coluna."&y=".$linha."'>".$coluna."|".$linha."</a></td>";
}
}
echo "</tr>";
//echo $x." | ".$y."<br>";
}
//echo count($mapa);*/
?>
</table>