[eluser]Lockzi[/eluser]
Okay, here we go!
Code:
function listTopics($f = null)
{
$this->db->select('*');
$this->db->where(array('topics.f_id' => htmlspecialchars($f, ENT_QUOTES)));
$this->db->join('members', 'topics.m_id = members.m_id');
$this->db->join('forums', 'topics.f_id = forums.f_id');
$this->db->orderby('topics.t_time', 'DESC');
$query = $this->db->get('topics');
return $query->result();
}
And a controller for demonstration
Code:
$data['topics'] = $this->forum->listTopics($data['forum']->f_id);
echo ($data['topics']->f_name);
To explain even further.
The basic problem is that it's returning a looong array since I'm using return result(). If I instead would use return row() it would work perfectly fine, but then I would only get one row.
And there's nothing wrong with the code, so don bother with asking questions about that
![Wink Wink](https://forum.codeigniter.com/images/smilies/wink.png)
Since it works fine in the views when I use a foreachloop.
Cheers, Lockzi