[eluser]Big E[/eluser]
I've read through all the multiple DB connect threads, gotten it down to the bare nitty gritty and it still doesn't work:
($db['smhc'] and $db['smhc_logs'] defined properly in database.php -- note: it doesn't matter which one is defined first in database.php; I've tested it both ways)
Code:
class Welcome extends CI_Controller {
private $SMHC_DB;
private $SMHC_LOGS_DB;
function __construct()
{
parent::__construct();
$this->SMHC_DB = $this->load->database('smhc',TRUE);
$this->SMHC_LOGS_DB = $this->load->database('smhc_logs',TRUE);
}
function index()
{
$Query = $this->SMHC_LOGS_DB->query("SELECT * FROM log_t");
$Row = $Query->row();
var_dump($Row);
exit;
}
This works fine - SMHC_LOGS_DB was the last DB loaded. If I switch the 'smhc' and 'smhc_logs' database loads:
Code:
$this->SMHC_LOGS_DB = $this->load->database('smhc_logs',TRUE);
$this->SMHC_DB = $this->load->database('smhc',TRUE);
The 'SELECT' query fails because it's running on the wrong database. According to all the threads, it shouldn't matter in which order it was loaded because they should both be able to operate independently.
Is there a setting somewhere that I'm missing?
USING: Windows XP, Apache 2.2, PHP 5.2.13, Mysql 5.1.45, CodeIgniter 2.0 -- but it also doesn't work on Linux/Apache/PHP 5.3.5/Mysql 5.1.55/CI 2.0 either