Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
yaditzal
Starting Member
22 Posts |
Posted - 2010-04-28 : 08:48:51
|
Hi.I need help with this problem.I need to connect more than one database using odbc from php.I'm doing a wdb base aplication in php and I have to use odbc but I don't know how to make the connection to 2 database.these is how I make a single connection.define('DB_HOST', 'Bupa01'); define('DB_USER', 'root'); define('DB_PASSWORD', 'root1'); define('DB_DATABASE', 'CWF'); $link = odbc_connect(DB_DATABASE, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server!'); }I have another database in the same server, the user and pw is same, the only thing that chanse is the database name.please any help with that.Thanks |
|
tosscrosby
Aged Yak Warrior
676 Posts |
Posted - 2010-04-28 : 12:06:20
|
I'm guessing you're using MySQL? If so, this isn't the right forum, although someone might be able to answer. Try sites where MySQL is discussed, such as:http://www.dbforums.com/Put you request in the appropriate forum. You'll likely get a quicker response there.Terry-- The problem with socialism is that you eventually run out of other people’s money. -- Margaret Thatcher |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2010-04-28 : 13:27:17
|
You have to create 2 link objects each for a different database.for example $link2 = odbc_connect(DB_DATABASE2, DB_USER, DB_PASSWORD);quote: Originally posted by yaditzal Hi.I need help with this problem.I need to connect more than one database using odbc from php.I'm doing a wdb base aplication in php and I have to use odbc but I don't know how to make the connection to 2 database.these is how I make a single connection.define('DB_HOST', 'Bupa01'); define('DB_USER', 'root'); define('DB_PASSWORD', 'root1'); define('DB_DATABASE', 'CWF'); $link = odbc_connect(DB_DATABASE, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server!'); }I have another database in the same server, the user and pw is same, the only thing that chanse is the database name.please any help with that.Thanks
|
|
|
|
|
|
|
|