Reputation: 11
How can i access in two different databases at the same time, i mean can i implement a search from database1 and save for example the id or another information to a database2?
Upvotes: 1
Views: 1168
Reputation: 72981
Yes. PHP has a few MySQL extensions. However, if you're just getting started, look at the MySQL functions for this. Specifically mysql_connect()
and mysql_select_db()
could be used to create separate connections to different databases or switch between them on the same connection.
Upvotes: 1
Reputation: 449415
If you have a user account that can access both databases, just prefix the database name:
SELECT database1.table1, database2.table2.....
as far as I know, you can even do JOINs, although I don't know about possible performance implications.
If you do not have a mySQL account that can access both databases, it's not possible.
Upvotes: 4