简体   繁体   中英

how to connect two database on the different host at the same time using php and mysql?

$connection1 = mysql_connect($servername,$username,$password);
$db1 = mysql_select_db($dbname,$connection1);

some html and php code here

$connection2 = mysql_connect($servername1,$username1,$password1);    
$db2 = mysql_select_db($dbname1,$connection2);

Error:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user '*****'@'***.com' (using password: YES) in /home/

Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/

Warning: mysql_query() [function.mysql-query]: Access denied for user '******'@'********' (using password: NO) in /home/

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/

I get this error when i want to fetch something or try to connect

您必须从托管cpanel的选项Remove MySQL中添加IP地址,以允许远程访问。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM