[eluser]Arrow768[/eluser]
Hi,
I am using two different databases:
server: Stores Infos about the User that have playes at a Orangebox Server
default: Stores the System-Tables
I have also enabled the Sessions of CodeIgniter
I am trying to access the databases with this code:
Code:
$DB_Server = $this->load->database('server', TRUE);
$DB_Main = $this->load->database('default', TRUE);
$ip = $_SERVER["REMOTE_ADDR"];
echo "Your-IP:". $ip."</br>";
$plugin_ip = str_replace(".", "", $ip);
$plugin_ip = str_replace(":", "", $plugin_ip);
//get steam_id from plugin-table
$DB_Server->where('ip', $plugin_ip);
$query_ip = $DB_Server->get('donate_autofill');
//print_r ($query_ip);
if($query_ip->num_rows === 0){
$this->session->set_userdata('played_on_server', 0);
}else{
$row_ip = $query_ip->row_array();
$steam_id = $row_ip["steamid"];
$this->session->set_userdata('played_on_server', 1);
$this->session->set_userdata('steam_id', $steam_id);
}
The Problem is, that codeigniter connects to the database that is loaded last:
The ci_donate_autofill table is located in the Server DB
Code:
A Database Error Occurred
Error Number: 1146
Table 'donsys.ci_donate_autofill' doesn't exist
SELECT * FROM (`ci_donate_autofill`) WHERE `ip` = '1'
Filename: E:\XAMPP\htdocs\Donator-Interface\system\database\DB_driver.php
Line Number: 330
If I move the default connect line above the Server connect line, I get the following error:
Code:
A Database Error Occurred
Error Number: 1146
Table 'servers.sessions' doesn't exist
UPDATE `sessions` SET `last_activity` = 1348328789, `user_data` = 'a:2:{s:9:\"user_data\";s:0:\"\";s:16:\"played_on_server\";i:0;}' WHERE `session_id` = '3ead3ad7c5b6fc77ad7078901cafeae5'
Filename: E:\XAMPP\htdocs\Donator-Interface\system\database\DB_driver.php
Line Number: 330
It would be great, if you could help me with my Problem