Outputting array results from Controller
Permalink
Hello in my controller i have a view function that runs a query to get data from a db. I have the data and now need to output it with something like a foreach loop within my view state on my single page.
In the controller view state i have
Can any one advise how i take the data from this function and display it in my view,php..?
In the controller view state i have
public function view() { $db = Loader::db(); $data = $db->getAll("SELECT * FROM btCpd"); $this->set('data', $data); }
Can any one advise how i take the data from this function and display it in my view,php..?
THANKS AGAIN FOR YOUR HELP NETJUNKY.
I HAVE PASTED THE CODE YOU PROVIDED IN MY VIEW.PHP. This has displayed the following text:
0: Array
1: Array
2: Array
3: Array
4: Array
5: Array
6: Array
I need to display items for each...e.g. title, hours date etc.
Can you explain how i map the database column names to achieve this please.
(Thank you for your patience)
I HAVE PASTED THE CODE YOU PROVIDED IN MY VIEW.PHP. This has displayed the following text:
0: Array
1: Array
2: Array
3: Array
4: Array
5: Array
6: Array
I need to display items for each...e.g. title, hours date etc.
Can you explain how i map the database column names to achieve this please.
(Thank you for your patience)
Try this:
or this
or this
awesome, thanks!