[eluser]IanMcQ[/eluser]
Changed both variables in MY_Controller to PUBLIC. It now reads:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Controller extends CI_Controller {
// Declare
public $db;
public $maindb;
function __construct()
{
// Do parent
parent::__construct();
// Load them in
$this->db = $this->load->database('default', TRUE);
$this->maindb = $this->load->database('maindb', TRUE);
}
}
Still having troubles accessing $this->maindb in a Library:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Sess
{
private $CI;
// --------------------------------------------------------------------
function __construct()
{
// --------------------------------------
// Get instance, do logging
// --------------------------------------
$this->CI =& get_instance();
log_message('debug', 'TDN-specific Session Class Initialized');
var_dump($this->CI->maindb); // == RETURNS NULL
[...]
var_dump returns NULL of $this->CI->maindb, which should be the maindb instance. Any ideas?
UPDATE: $this->CI->db seems to be working fine, for whatever reason. Have a feeling it has to do with the fact that it's the default anyway, and is wired for use in the application anywhere already.