Jump to content

Using \IPS\Db::i()->select


Go to solution Solved by Matt,

Recommended Posts

Posted

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?

  • Management
  • Solution
Posted

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...