We are working our way through the long tutorial of the fat free framework. We have made our connection to the database and understand it’s workings. However, we are stuck in the section about mapping a table and loading a single record.
This is the related code:
$f3->route('GET /',
function($f3){
$db=new DB\SQL(
'mysql:host=localhost;port=3306;dbname=liselore',
'jow',
''
);
$test1 = new DB\SQL\Mapper($db,'test1');
$test1->load('id=1');
$f3->set('result', $test1);
$template = new Template;
echo $template->render('views/homepage.html');
}
);
$f3->run();
This is the template file:
<repeat group="{{ @result }}" value="{{ @item }}">
<li>{{ @item.name }} : {{@item.age}}</li>
</repeat>
I don’t get an error, so i can’t see what’s wrong here. Some help would be appreciated.
Thx,