[eluser]axiom82[/eluser]
I have the most hair pulling scenario when trying to load a database on the fly in Code Igniter.
If I use a method to return a string and that string has a number on the end, the number is removed during the database load. If I use a string literal with the same value, the number remains during the database load. Can somebody explain this?
I've done a strcmp() on $db1 and $db2 below and it comes back equal. This issue occurs when sending a database update request using Code Igniter's XMLRPC class.
Does anyone have any idea why $db1 and $db2 are behaving differently?
Here is my code:
Code:
function database_connect(){
$db1 = $this->database('name'); // returns "database_name2" (doesn't work)
$db2 = "database_name2"; // is "database_name2" (works)
$database = array(
'hostname' => 'localhost',
'username' => 'user',
'password' => 'password',
'database' => $db1, // used here $db2 works, $db1 does not???
'dbdriver' => 'mysql',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci'
);
$this->db = $this->load->database($database, true);
}