View Single Post
  #1 (permalink)  
Old 05-21-2008, 11:00 AM
keenlio keenlio is offline
Junior Member
 
Join Date: Apr 2008
Posts: 5
Thumbs down Please help, how to connect two database from index.php

Currently I am using one database for my project, but would want to try connect two database at the same time.
I am using the Adapter factory method with a Zend_Config object as below:

// load configuration
$config = new Zend_Config_Ini('./application/config.ini', 'general');
Zend_Registry::set('config', $config);

// setup database
$db = Zend_Db::factory($config->db->adapter,$config->db->config->toArray());
$db->setFetchMode(Zend_Db::FETCH_OBJ);
Zend_Db_Table::setDefaultAdapter($db); //default adapter for Zend_DB_Table extend class
Zend_Registry::set('mydb', $db); //store the adapter for global use

But I can't write my code right to connect two database. Please advice
Reply With Quote