Jump to content


Photo

Using more then on DB at once


  • Please log in to reply
3 replies to this topic

#1 php4.23

php4.23
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 12 November 2003 - 04:37 AM

Can I set up a connection to more then one MySQL database and use them both in a single query?

I hope I made sense.
thanks[/b]

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 12 November 2003 - 05:21 AM

Can I set up a connection to more then one MySQL database and use them both in a single query?


I am editing this post as I accept the answer give by another member. :wink: Good call!

But you still have to avoid this.

Database name is a just a logical identifer for categorizing. Now how did you have two tables that are linked in two sperate database? I guess you need to spend some time reading RDBMS concepts. :wink:
Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#3 Glish

Glish
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 12 November 2003 - 06:05 AM

you dont have to make 2 connections, use the syntax below:

ie : select tb1.pid,tb2.name from database1.tb1,database2.tb2 where whatyouwant=whatyouneed;

#4 php4.23

php4.23
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 12 November 2003 - 06:51 PM

Now how did you have two tables that are linked in two sperate database? I guess you need to spend some time reading RDBMS concepts.  


Let me explain better. There are two applications both have there own database(local) for storeing their own information, but they access a remote database (on another server) where they share a table with all the registered users.

So how can I create a query that can access a local DB and a remote DB at the same time? Can I connect two a local DB and the remote DB and use them both in a query.
thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users