[eluser]doubleplusgood[/eluser]
Hey there,
I'm making a little news scroller for my website that needs to appear on ever page. So I have created an include view as follows;
Code:
<?
$this->obj =& get_instance();
$this->obj->load->model('ticker_model', 'ticker', TRUE);
$ticker_items = $this->obj->ticker->getTicker();
?>
<?php
echo "<ul id='ticker01'>";
foreach($ticker_items as $item) {
echo "<li>";
echo $item['message'];
echo "</li>";
}
echo "</ul>";
?>
My model is structure like this;
Code:
<?php
class Ticker_model extends Model {
function getTicker ()
{
$this->db->where('published', 1);
$this->db->limit(10);
return $this->db->get('mcd_ticker');
}
}
?>
But when I view the page it reports 'Message: Undefined index: message'. The DB table that the model relates to just has id, message, published.
It's probably something silly in the way I have done my foreach and I've not had enough coffee yet. Wondered if anyone might be able to offer up some help?
Thank you.