Hi!
Another question from me.
I connect to a database and get a row from the database
Code:
$sql = 'SELECT commentaar, id FROM data WHERE id = 1'; // SQL commando
$result = $db->fetchRow($sql);
After this I get the 2 columns and put them in an Array variable
Code:
$lijst = array("a"=>$result->id, "b"=>$result->commentaar);
Next i add this variable ($lijst) to the $this Var
Code:
$this->lijst = $lijst;
got 2 echo statements here to check if there really is something inside the DB
Code:
echo $lijst["a"];
echo $lijst["b"];
Then I get redirected to my view.
Code:
<table border="1px">
<th><h1 align="center">resultaat</h1></th>
<tr>
<td><?= $this->lijst["a"]; ?></td>
<td><?= $this->lijst["b"]; ?></td>
</tr>
</table>
I get a page loaded with 1 table on it with a header saying "resultaat" and no table rows or anything?
What am I doing wrong? or can't you pass along arrays? I'm mostly likely passing it along wrongly?