Jump to content

Connecting to 2 databases


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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...