You are here: Re: Query 2 MySQL databases in 1 statement « PHP Programming Language « IT news, forums, messages
Re: Query 2 MySQL databases in 1 statement

Posted by Miguel Cruz on 07/26/06 18:41

"noor.rahman@gmail.com" <noor.rahman@gmail.com> wrote:
> I was wondering how it may be possible to query 2 MySQL databases using
> one query statement from PHP.
>
> For instance: SELECT database1.tableA.field1 UNION
> database2.tableB.field2.
>
> My concern is, when connecting to MySQL (or sending a query), I only
> specify 1 database connection resource ID. How does that play out when
> connecting to 2 databases?

As long as the two databases are accessible via the same connection
(i.e., they are on the same server and the login credentials grant you
the required access for both of them) then it's a non-issue, it works
fine.

Otherwise it doesn't, and you will have to create a user that has the
appropriate select privileges on both databases or whatever.

miguel
--
Photos from 40 countries on 5 continents: http://travel.u.nu
Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
Airports of the world: http://airport.u.nu

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация