Welcome Guest, Not a member yet? Register   Sign In
Multiple database : Fatal error: Call to a member function result_array() on a non-object
#1

[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 ..
#2

[eluser]Kijer[/eluser]
I raised the subject a bit please, I do not think it's complicated, there must be a subtlety that eludes me ... : (
#3

[eluser]Arun Joshi[/eluser]
What your configuration value here?

$db['default']['db_debug'] in config/database.php
#4

[eluser]Kijer[/eluser]
I do not have the code on the pc where I am, but I think not too wrong to say: TRUE
#5

[eluser]Kijer[/eluser]
Solved !

You had finally right!
I was off the debug and I do not see the syntax error in my query!

A thousand thank you Arun Joshi




Theme © iAndrew 2016 - Forum software by © MyBB