flywheeler Posted December 27, 2008 Share Posted December 27, 2008 I got a super tricky problem!!! In PHP, how can you have 2 active connections to 2 databases that are on 2 different servers at the same time inside a while loop????? I've tried this already: $db1 = mysql_pconnect($hostname1, $username1, $password1) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database_1, $db1); $db2 = mysql_pconnect($hostname2, $username2, $password2) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database_2, $db2); ...and then I do my thing inside a while loop, and it only connects to one database. Any ideas???? thanks, Ali Quote Link to comment Share on other sites More sharing options...
Flames Posted December 27, 2008 Share Posted December 27, 2008 Why the hell have you made this twice? And having one as a poll doesnt count. Quote Link to comment Share on other sites More sharing options...
hobeau Posted December 27, 2008 Share Posted December 27, 2008 There is an issue with mysql_pconnect in which if you are connecting to multiple databases you need to specify the socket path. In other words, if the database is on your localhost, you would specify mysql_pconnect('localhost:3306'... assuming of course the port hasn't changed from the default 3306. Hope this works for you!!! Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted December 27, 2008 Share Posted December 27, 2008 I question the requirement for these persistent connections..... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.