mysql - Can mysql_pconnect be called multiple times in one php page? -
I was wondering if it is valid for calling mysql_pconnect several times in a php page? Also, if possible, should I either close my last ISSL handle or something? Actually the following code is okay? Or is there a lack of some other steps?
mysql_pconnect ("ip: 3306", "user", "pass") or die (mysql_error ()); Mysql_select_db ("test") or die (mysql_error ()); // Some SQL queries mysql_pconnect ("ip2: 3306", "user", "pass") or die (mysql_error ()); Mysql_select_db ("test") or die (mysql_error ()); // Another SQL query
Yes but this is probably a better practice, both the headset To store both in the database and make the correct DB explicit use.
dbServer1 = mysql_pconnect ("ip: 3306", "user", "pass") or die (mysql_error ()); Mysql_select_db ("test", dbServer1) or die (mysql_error ()); DbServer2 = mysql_pconnect ("ip: 3306", "user", "pass") or die (mysql_error ()); Mysql_select_db ("test", dbServer2) or die (mysql_error ()); // Both databases mysql_query manipulate ("...", dbServer1); Mysql_query ("...", dbServer2);
Comments
Post a Comment