Active database connection.

See also



developer/globals.php, line 122
These are the global variables that Drupal uses.


global $active_db;


Jztinfinity’s picture

As implied by the see also, this is set in db_set_active, it is usually left implied by the db functions, however there are occasions when this needs to be remembered, such as if running multiple db connections, remember which one is your active (although I imagine you could switch active for interesting results, for example, based on trigger switch between databases of two drupal installations). More common is for certain special database functions you may need to use the PHP DB functions directly. One particular occasion I had to utilize a stored procedure and in that case it is useful to use mysqli functions directly in conjunction w/ the $active_db variable