我有这个存储连接信息的数组,我想在执行查询时使用它
$dblist = array();
$dblist[] = array(
'host'=>'192.168.1.20',
'username'=>'root',
'password'=>'root1',
'database'=>'unsubscribe_1',
'table'=>'subscribers'
);
$dblist[] = array(
'host'=>'192.168.1.5',
'username'=>'root',
'password'=>'root2',
'database'=>'unsubscribe_test',
'table'=>'subscribers2'
);
foreach($dblist as $list)
{
$host = $list['host'];
$username = $list['username'];
$password = $list['password'];
$db = $list['database'];
$tb = $list['table'];
$conn1 = mysql_connect($host,$username,$password) or die(mysql_error());
mysql_select_db($db,$conn1) or die(mysql_error());
$sql = "select * from $db";
$query = mysql_query($sql,$conn1) or die(mysql_error());
}
问题是我一直收到此错误“主机'192.168.1.5'不允许连接到此MySQL服务器”
这里有什么问题?
答案 0 :(得分:1)