Reputation: 5858
I have this array that store the connection info and i want to use it when perform the query
$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());
}
The problem is i keep getting this error "Host '192.168.1.5' is not allowed to connect to this MySQL server"
What is the problem here?
Upvotes: 0
Views: 1368