Multiple database Connections

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vivekjain
Forum Commoner
Posts: 76
Joined: Thu Jan 08, 2004 12:38 am

Multiple database Connections

Post by vivekjain »

Hi,
I would like to know if I can connect to 2 different database using PHP. I need to access different tables from different database.

Thanks
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

have you tried it?
vivekjain
Forum Commoner
Posts: 76
Joined: Thu Jan 08, 2004 12:38 am

Mutiple db connection

Post by vivekjain »

yes, I am getting this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

very very likely, you have an error in your query syntax.

mysql_error()
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post by BDKR »

LOL! You may want to check that you connect with success before going forward with the query.
vivekjain
Forum Commoner
Posts: 76
Joined: Thu Jan 08, 2004 12:38 am

multiple database connection

Post by vivekjain »

It works now, I had to use the databse name.tablename and it worked.

thanks
Post Reply