sc_lookup and sc_select columns

After fetching with

sc_lookup(infopos,"SELECT name,age from positioninfos");

the data from the database; I wanted to acces the data :

foreach({infopos} as $val){
echo $val['name'];
}

but got error saying undefined offset(meaning the key name doesn’t exist). The $val table should be an name key table and at the same time indexed to allow developpers to access it the way they want either $val[‘name’]; or $val[0]; forcing the use of indexing limits the power of using php in scriptcase.