How to connect to two databases at the same time

Reply

Join Date: Apr 2008
Posts: 109
Reputation: architact is an unknown quantity at this point 
Solved Threads: 7
architact's Avatar
architact architact is offline Offline
Junior Poster

How to connect to two databases at the same time

 
0
  #1
Mar 19th, 2009
Hello Guys I want to connect two databases at the same time but it looks like the php is only picking up the second database.

One database is on my localhost and the other one is on server, I want to transfer the data from my localhost database to the database on the server. I have also tried passing the 4th argument to the mysql_connect function but I can't get it to work.
mysql_connect("localhost", "name", "password", true);

Please help me.

Thanks
If you think we fight for money and you fight for honor, then remember everyone fights for the thing they don't have...
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 101
Reputation: PirateTUX is an unknown quantity at this point 
Solved Threads: 3
PirateTUX's Avatar
PirateTUX PirateTUX is offline Offline
Junior Poster

Re: How to connect to two databases at the same time

 
0
  #2
Mar 19th, 2009
What language are you using?
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 109
Reputation: architact is an unknown quantity at this point 
Solved Threads: 7
architact's Avatar
architact architact is offline Offline
Junior Poster

Re: How to connect to two databases at the same time

 
0
  #3
Mar 19th, 2009
php/mysql
If you think we fight for money and you fight for honor, then remember everyone fights for the thing they don't have...
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 190
Reputation: mwasif is an unknown quantity at this point 
Solved Threads: 25
mwasif mwasif is offline Offline
Junior Poster

Re: How to connect to two databases at the same time

 
0
  #4
Mar 19th, 2009
Are you using link identifier with mysql_query()?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,749
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 331
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: How to connect to two databases at the same time

 
0
  #5
Mar 19th, 2009
http://in.php.net/mysql_select_db Read the comments, especially of buzz at oska dot com
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 4
Reputation: abhi211285 is an unknown quantity at this point 
Solved Threads: 1
abhi211285's Avatar
abhi211285 abhi211285 is offline Offline
Newbie Poster

Re: How to connect to two databases at the same time

 
0
  #6
Jul 24th, 2009
Originally Posted by architact View Post
Hello Guys I want to connect two databases at the same time but it looks like the php is only picking up the second database.

One database is on my localhost and the other one is on server, I want to transfer the data from my localhost database to the database on the server. I have also tried passing the 4th argument to the mysql_connect function but I can't get it to work.
mysql_connect("localhost", "name", "password", true);

Please help me.

Thanks
This help you out..
  1. $link=mysql_connect("localhost", "name", "password", true);
  2. $link1=mysql_connect("localhost", "name", "password", true);
  3.  
  4. $mysql_query($qry,$link);
  5. $mysql_query($qry1,$link1);
This the one.
Last edited by peter_budo; Jul 24th, 2009 at 3:03 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Abhishek Joshi
IT-Analyst
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC