If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > 2 database connections in same page

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-05-04, 05:28
neil.harwani neil.harwani is offline
Registered User
 
Join Date: Feb 2004
Posts: 3
Post 2 database connections in same page

This is my problem. My website database on internet needs to be updated. I want to open two connections from my localhost server, IIS 5 on which my PHP pages are working: 1st connection: To my database at localhost from PHP page (this is simple and done), 2nd connection: i want to open a connection to my database at my website on internet in this very same page on localhost, so that I could simply take data from my localhost MySQL database and upload directly into my website MySQL database on my internet. How do open two simultaneous connections to 2 different database from same PHP page ? I hope this is possible.
Reply With Quote
  #2 (permalink)  
Old 04-05-04, 07:26
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: 2 database connections in same page

Quote:
Originally posted by neil.harwani
This is my problem. My website database on internet needs to be updated. I want to open two connections from my localhost server, IIS 5 on which my PHP pages are working: 1st connection: To my database at localhost from PHP page (this is simple and done), 2nd connection: i want to open a connection to my database at my website on internet in this very same page on localhost, so that I could simply take data from my localhost MySQL database and upload directly into my website MySQL database on my internet. How do open two simultaneous connections to 2 different database from same PHP page ? I hope this is possible.
This is PHP related question please go to the PHP forum.

Btw: you can create two connection in PHP very simple.

$conn1 = mysql_connect("host1","username","password");
$conn2 = mysql_connect("host2", "username", "password");

then in mysql_query you need to specify relevant connection descriptor.
For more informations check documentation on : http://www.php.net
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On