Welcome Guest, Not a member yet? Register   Sign In
Connecting to second db issue
#1

[eluser]Bramme[/eluser]
Hey all.

I need to connect to a second db (the phpbb db) to fetch a list of recent topics.

I use this code:
Code:
$dsn = 'mysql://user:[email protected]/phpbb3';
$con = $this->load->database($dsn, TRUE);

$con->select('phpbb3_topics.*');
$con->join('phpbb3_posts', 'phpbb3_posts.topic_id = phpbb3_topics.topic_id');
$con->order_by('phpbb3_posts.post_time', 'desc');
$query = $con->get('phpbb3_topics', 4, 0);
foreach($query->result() as $row) {
    $url = "/forum/viewtopic.php?f={$row->forum_id}&t;={$row->topic_id}";
    $top[$url] = $row->topic_title;    
}
However I get a "Call to a member function result() on a non-object on line x" Line x is where the foreach loop is...


Messages In This Thread
Connecting to second db issue - by El Forum - 08-13-2008, 01:05 AM
Connecting to second db issue - by El Forum - 08-13-2008, 02:01 AM
Connecting to second db issue - by El Forum - 08-13-2008, 02:07 AM
Connecting to second db issue - by El Forum - 08-13-2008, 02:24 AM
Connecting to second db issue - by El Forum - 08-13-2008, 02:26 AM
Connecting to second db issue - by El Forum - 08-13-2008, 02:28 AM
Connecting to second db issue - by El Forum - 08-13-2008, 02:31 AM
Connecting to second db issue - by El Forum - 08-13-2008, 02:35 AM
Connecting to second db issue - by El Forum - 08-13-2008, 02:40 AM
Connecting to second db issue - by El Forum - 08-13-2008, 02:53 AM
Connecting to second db issue - by El Forum - 08-13-2008, 02:58 AM
Connecting to second db issue - by El Forum - 08-13-2008, 05:34 AM
Connecting to second db issue - by El Forum - 08-13-2008, 06:00 AM
Connecting to second db issue - by El Forum - 08-13-2008, 06:21 AM
Connecting to second db issue - by El Forum - 08-13-2008, 06:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB