User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 373,521 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,800 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 942 | Replies: 1
Reply
Join Date: Jul 2006
Posts: 4
Reputation: milliondollar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
milliondollar milliondollar is offline Offline
Newbie Poster

2 connections problem

  #1  
Jul 22nd, 2006
I create 2 connectionsand then try to select the current active database:
$aaa_link = mysql_connect("host1","user1","pass1") or die(mysql_error());
$bbb_link = mysql_connect("host2","user2","pass2")or die(mysql_error());
 
mysql_select_db("dbname1", $aaa_link) or die(mysql_error());

However, mysql_select_db fails with error:
Access denied for user: "user2" to database "dbname1"
What is wrong here?
http://www.milliondollarhosting.net
Cheap hosting plans with bunch of Disk Space and Data Transfer. Best solution for Game Hosting, Image Hosting, Flash Hosting and Video Hosting. Low cost domain registration and affordable Linux, PHP, MySQL web hosting.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2006
Posts: 4
Reputation: milliondollar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
milliondollar milliondollar is offline Offline
Newbie Poster

Re: 2 connections problem

  #2  
Jul 22nd, 2006
Sorry, mistake - host1 = host2, but users, passwords and dbnames there are different. By the way the next code worked perfectly:
$aaa_link = mysql_connect("host1","user1","pass1") or die(mysql_error());
mysql_select_db("dbname1", $aaa_link) or die(mysql_error());
That is the bbb_link's line that caused this problem for some reason. It appears as if after the second mysql_connect the mysql tries to work on the $bbb_link database and ignores the existence of $aaa_link.
http://www.milliondollarhosting.net
Cheap hosting plans with bunch of Disk Space and Data Transfer. Best solution for Game Hosting, Image Hosting, Flash Hosting and Video Hosting. Low cost domain registration and affordable Linux, PHP, MySQL web hosting.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MySQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 6:27 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC