Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
tPx Posted September 6, 2021 Posted September 6, 2021 Hello guys, im here to ask you 1 simple question How can i use the \IPS\Db::i()->select in a template ? I mean i know i have this example : $select = \IPS\Db::i()->select( '*', 'some_table', array( 'field=?', 1 ), 'some_column DESC', array( 0, 10 ) ); But i dont understand the logic, i want to extract for example with that method all the names from core_members Can you help me with that? Jimi Wikman 1
Management Solution Matt Posted September 7, 2021 Management Solution Posted September 7, 2021 Ideally you'd not use queries like that in a template, and instead do that in a controller however life isn't always as neat so... {{foreach( \IPS\Db::i()->select(...) ) as $row}} <strong>My name is: {$row['name']}</strong> {{endforeach}} Will do the trick. Jimi Wikman, IPCommerceFan and tPx 2 1
Recommended Posts