RE: [PHP-DB] MySQL Multi-DB Join
assuming the dtaabases are on the same server $query = select db1.table1.field from db1.table1, db2.table2 where db1.table1.field1 = db2.table2.field2 $result = mysql_query($query,$conection) HTH Peter -Original Message- From: Rod Strumbel [mailto:[EMAIL PROTECTED] Sent: 18 March 2004 14:48 To: '[EMAIL PROTECTED]' Subject: [PHP-DB] MySQL Multi-DB Join Is there a way through the php mysql commands to join tables between databases? Is simple enough at MySQL command line, but can't for the life of me figure out how to do it in PHP. Thanks all, R -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL Multi-DB Join
?!? And just use the normal old db selection command for it? Which of the DBs would you select, or does it matter? mysql_select_db($databasename,$dbhandle); Think that is what has been confusing me. If you can select just one db, then what is that select_db command really doing? Is it just establishing a mysql session, and once established you can issue pretty much any mysql command through the mysql_query command? If that IS the case, then why bother specifying the DB at all just issue the mysql_connect, and go straight to the mysql_query (although that doesn't work...tried it)? Just trying to figure out what that mysql_select_db is doing. Oh, and yes... the databases are on the same server Thanks again, R -Original Message- From: Peter Lovatt [mailto:[EMAIL PROTECTED] Sent: Thursday, March 18, 2004 9:02 To: Rod Strumbel; [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL Multi-DB Join assuming the dtaabases are on the same server $query = select db1.table1.field from db1.table1, db2.table2 where db1.table1.field1 = db2.table2.field2 $result = mysql_query($query,$conection) HTH Peter -Original Message- From: Rod Strumbel [mailto:[EMAIL PROTECTED] Sent: 18 March 2004 14:48 To: '[EMAIL PROTECTED]' Subject: [PHP-DB] MySQL Multi-DB Join Is there a way through the php mysql commands to join tables between databases? Is simple enough at MySQL command line, but can't for the life of me figure out how to do it in PHP. Thanks all, R
RE: [PHP-DB] MySQL Multi-DB Join
I think as you are specifying the db in the query you dont need to select it. If you do, mysql still uses DBs as specified in the query. Peter -Original Message- From: Rod Strumbel [mailto:[EMAIL PROTECTED] Sent: 18 March 2004 15:14 To: 'Peter Lovatt'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] MySQL Multi-DB Join ?!? And just use the normal old db selection command for it? Which of the DBs would you select, or does it matter? mysql_select_db($databasename,$dbhandle); Think that is what has been confusing me. If you can select just one db, then what is that select_db command really doing? Is it just establishing a mysql session, and once established you can issue pretty much any mysql command through the mysql_query command? If that IS the case, then why bother specifying the DB at all just issue the mysql_connect, and go straight to the mysql_query (although that doesn't work...tried it)? Just trying to figure out what that mysql_select_db is doing. Oh, and yes... the databases are on the same server Thanks again, R -Original Message- From: Peter Lovatt [mailto:[EMAIL PROTECTED] Sent: Thursday, March 18, 2004 9:02 To: Rod Strumbel; [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL Multi-DB Join assuming the dtaabases are on the same server $query = select db1.table1.field from db1.table1, db2.table2 where db1.table1.field1 = db2.table2.field2 $result = mysql_query($query,$conection) HTH Peter -Original Message- From: Rod Strumbel [mailto:[EMAIL PROTECTED] Sent: 18 March 2004 14:48 To: '[EMAIL PROTECTED]' Subject: [PHP-DB] MySQL Multi-DB Join Is there a way through the php mysql commands to join tables between databases? Is simple enough at MySQL command line, but can't for the life of me figure out how to do it in PHP. Thanks all, R -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL Multi-DB Join
From: Rod Strumbel [EMAIL PROTECTED] If you can select just one db, then what is that select_db command really doing? All it's doing is issuing a USE database query so you can say SELECT * FROM table instead of SELECT * FROM database.table You want to use select_db() so that you don't have prefix all of the tables in your queries with a database name. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php