hi
I have two different databases. I am trying to write my first module and got in the problem of switching between databases. I tried db_set_active but that's not helping much. Here is my scenario. I have two databases (say drupal and B). In my module I switch to Database B using db_set_active('B') and use Qcodo framework to build up my output. After that I try to switch back to database drupal using db_set_active('default') but I get an error message. The error message indicates that its trying to find session table in Database B , while it should be looking in the drupal database.
Below is my function where i am juggling different databases
function treemenu_builder() {
global $user;
require_once('prepend.inc');
drupal_add_js(base_path() . path_to_theme() .'/external/dtree.js');
theme_add_style(base_path() . path_to_theme() .'/external/dtree.css');
db_set_active('B');
$js = 'a = new dTree("a");a.config.useCookies=false;';
$js .='a.add(0,-1,"Articles","javascript: void(0);");';
// Add Articles
$articles = Articles::LoadAll();
for($i=0; $i
$title = $articles[$i]->__get('Title');
$id = $articles[$i]->__get('ArticleId');
$js = 'a.add($id,0,"' . $title . '", "javascript: void(0);");';
}
db_set_active('default');
$output = '
';
$output .= '
' . $js . '
';