php - Using fat-free-framework fetch from table -


how fetch data table using fat free

my code:

$user=new db\sql\mapper($db,'test1'); $user->load() 

but want display data without query. want print data using foreach statement

solution mapper

the first solution exports mapper data array before iterating records.

$data = []; $user = new db\sql\mapper($db, 'test1');  ($user->load(); !$user->dry(); $user->next()) {     $data[] = $user->cast(); } 

now it's possible use foreach($data $user) iterate users.

solution sql

it's possible fetch records without mapper object.

foreach ($sql->exec('select * test1') $user) {     echo $user['name']; } 

more information

have @ documentation more information , tips:


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -