Jump to content

Connecting to 2 databases


vchris
 Share

Recommended Posts

Well, you just have to declare the connection for each database. Here's an example:$con1 = mysql_connect("server1","user1","password1");$con2 = mysql_connect("server2","user2","password2");When using functions like mysql_query() don't forget to put $con1 or $con2 as the connection parameter. For example:$data1 = mysql_query("SELECT * FROM table",$con1);$data2 = mysql_query("SELECT * FROM anothertable",$con2);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...