|
Posted by Tony Marston on 07/26/06 11:19
When you connect to MySQL you are connecting to a server, not a database,
and a server may contain any number of databases. The reason for using the
mysql_select_db() command is to select a default database so that you do not
have to prefix each table name with a database name. It is still possible to
access a table from another database in a single query simply by using
"database.table".
HTH
--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
<noor.rahman@gmail.com> wrote in message
news:1153897335.618935.42770@m79g2000cwm.googlegroups.com...
>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?
>
> Thanks.
>
Navigation:
[Reply to this message]
|