Jump to content

Recommended Posts

You can make multiple connections to a MySQL server in the same script, but why would you want to?  As for connecting to multiple databases, yes, you can do that to, make sure you use the optional link identifier with mysql_query().

Regards
Huggie
Why not? =)
If you are using MySQL, [b]mysql_connect[/b] function returns a MySQL link identifier.
You can use it practically in every [b]mysql_...[/b] function (see manual) as it shown below:
--
$id1 = mysql_connect(...); // first connection
$id2 = mysql_connect(...); // second connection
$query = "...";
$res1 = mysql_query($query, $id1); // perform query using first connection
$res2 = mysql_query($query, $id2); // perform query using second connection
--
Link identifier is not nessesary argument. If link_identifier isn't specified, the last opened link is assumed.
This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.