Welcome Guest, Not a member yet? Register   Sign In
Using Multiple Databases
#2

[eluser]PhilTem[/eluser]
I guess, this could be a solution to your problem Wink

Code:
function get_some_information($site)
{
  static $DB;
  
  isset($DB) OR $DB = $this->load->database($site, TRUE);
  
  // continue with other code, if necessary.
}

Will load the database only once since it's a static variable that get's instantiated on the first call of the function/method "get_some_information".


Messages In This Thread
Using Multiple Databases - by El Forum - 01-22-2013, 03:19 AM
Using Multiple Databases - by El Forum - 01-22-2013, 04:38 AM
Using Multiple Databases - by El Forum - 01-22-2013, 06:46 AM
Using Multiple Databases - by El Forum - 01-22-2013, 07:11 AM
Using Multiple Databases - by El Forum - 01-23-2013, 09:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB