Sometimes when you're debugging you might want to check which is the currently selected database. The following code will print out the current database to the messages area:
<?php
drupal_set_message(db_result(db_query('select database()')));
?>
Submitted by oliver on Tue, 17/04/2012 - 10:03
Drupal 7 version <?php $m =
Drupal 7 version
<?php$m = db_query('select database() as base') ->fetchObject();watchdog('called', "The database is @var", array('@var' => $m->base));?>
I haven't tested this but
I haven't tested this but thanks for the comment!
Oliver
Post new comment