简体   繁体   中英

Connecting to a MySQL Database Error

So, I have a very confusing problem with a client's php script. The problem basically is that MySQLi is connecting to another server, not the server that I specified in the code . Here is my code:

    <?php
$list = ['0','137.74.186.210', '137.74.186.211', '137.74.186.212'];

foreach ($list as $value) {
    if ($value == '0') {
        continue;
    }
    echo "<br><h2><strong>Connecting to {$value}</strong></h2><br>";
     $mysqli_connection = new MySQLi($value,"root","PASSWORD","LHskywars");
    if ($mysqli_connection->connect_error) {echo "Not connected, error: " . $mysqli_connection->connect_error;}else{echo "Connected.";}   
}

?>

Here is the screenshot of the script: 测试脚本的屏幕截图

SOLVED!

The access of the server 1 ("137.74.186.211") was not allowed to the server 2 ("137.74.186.212").

-.-

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