I'm working on displaying data on a table. It works to display one row of data but I can't seem to loop it. It keeps saying "Undefined offset: 0", "* *", "*Undefined offset: 2 *" and keeps looping the error to the number of my results.
Here is my code: (this does not work)
<?php
for ($i = 0; $i < count($Results); $i++) {
echo "
<tr>
<td>{$Results[$i]['Namn']}</td>
<td>{$Results[$i]['Efternamn']}</td
<td></td>
</td>
</tr>
";
}
?>
This works when I'm displaying one row only.
<?php
echo "
<tr>
<td>{$Results['Namn']}</td>
<td>{$Results['Efternamn']}</td>
<td></td>
</td>
</tr>
";
?>
Edit: How I get $Results:
This is from my controller layer (MVC)
$displayResults = new Sok($name, $aftername);
$Results = $displayResults->getSearchResult();
include "../view/test.php";