•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 375,172 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 2,135 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: 947 | Replies: 1
![]() |
•
•
Join Date: Jul 2006
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
I create 2 connectionsand then try to select the current active database:
However, mysql_select_db fails with error:
What is wrong here?
$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"
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.
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.
•
•
Join Date: Jul 2006
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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.
$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.
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.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
- Network Problem-Workstation won't communicate with Server (Networking Hardware Configuration)
- Too many connections error (MySQL)
- Would love feedback on my site (Website Reviews)
- xp locks up (Windows NT / 2000 / XP / 2003)
- Cannot detect the drive names and their file system (Windows NT / 2000 / XP / 2003)
- Wireless "B" networks not working anymore (Networking Hardware Configuration)
- I had a experience of a website coded in PHP (PHP)
- Can't access to remote computer (Windows NT / 2000 / XP / 2003)
- Having Trouble Staying Online Win98 (Networking Hardware Configuration)
Other Threads in the MySQL Forum
- Previous Thread: Its really a problem on INSERT statement
- Next Thread: remote mysql connection


Linear Mode