[eluser]Kijer[/eluser]
Hello,
I have a little problem, I can not run my query on a secondary database.
I get the error:
Fatal error: Call to a member function result_array () is a non-object
Why? I think I have no syntax error: /
Here is the code of my method (from the class phpbb3 available in the wiki)
Code:
/**
* Returns all user groups.
*
* @return array User groups.
*/
public function getUserGroupMembership()
{
$forum = $this->CI->load->database('forum',TRUE);
$userId = $this->_user->data['user_id'];
$query = $forum->select('g.group_name')
->from($forum->database . 'groups g')
->from($forum->database . 'user_group u')
->where('u.user_id',(int) $userId)
->where('u.group_id', 'g.group_id', FALSE)
->get();
foreach ($query->result_array() as $group)
{
$groups[] = $group['group_name'];
}
return $groups;
}
thanks you ..