开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜