Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    3

    Post Unanswered: 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.

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: 2 database connections in same page

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •