repeat problem

34 views
Skip to first unread message

Olof Glans

unread,
Oct 19, 2017, 12:17:05 PM10/19/17
to Fat-Free Framework
Hi! This repeat only gives me 1 entry from database, though I know it should have atleast 3.

Controller:
$comments = new DB\SQL\Mapper($db,'comments');
$comments->load();
$f3->set('comments', $comments);
echo \Template::instance()->render('views/home/home.php');


View (home.php):
<repeat group="{{ @comments }}" value="{{ @comment }}">
    <p>{{ trim(@comment) }}</p>
</repeat>

When I ask for the number of affected rows for the query it says 2, and my database says 2 too.

xfra35

unread,
Oct 19, 2017, 3:13:33 PM10/19/17
to Fat-Free Framework
load() is for record-by-record navigation. Try find().

Reply all
Reply to author
Forward
0 new messages