开发者

Can you do queries against two databases if mysql_select_db was already used?

开发者 https://www.devze.com 2022-12-16 20:37 出处:网络
I have c开发者_开发百科ode that in the connection setup selects the database using mysql_select_db().

I have c开发者_开发百科ode that in the connection setup selects the database using mysql_select_db().

$link = mysql_connect('localhost', 'user', 'pass');
mysql_select_db("database1");

Can I later run a query against two databases such as:

SELECT database1.row, database2.row 
FROM database1.table, database2.table 
WHERE database1.row = database2.otherrow

even though "database1" was already selected at first? Or is there a method for unselecting the database?


You can. Also check this out: How do I construct a cross database query in PHP?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号