[eluser]blasto333[/eluser]
I have CodeIgnitor setup to pick the database based on the subdomain it is loaded in (as shown below).
I turned of persistent connections as I use temp tables and different databases. It seems to be working fine, but I was just wondering if there are any potential problems. (I also use database backed sessions)
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$active_group = "default";
$active_record = TRUE;
$phppos_client_name = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], '.'));
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "USER";
$db['default']['password'] = "PASSWORD";
$db['default']['database'] = "db_$phppos_client_name";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "phppos_";
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
/* End of file database.php */
/* Location: ./application/config/database.php */