警告:mysqli_connect():( HY000 / 2002):php_network_getaddresses:getaddrinfo failed:名称或服务未知

时间:2015-11-14 15:11:10

标签: php html database

我试图连接到我的数据库并显示此错误。我正在为我的数据库使用付费服务器。

function connect_to_database()
{
    $username = "treq";
    $password = "treq";
    $hostname = "89.46.2.250";
    $database = "tr";
    $con = mysqli_connect($username, $password, $hostname, $database) or die ("Connecting to MySQL failed");
    return $con;
}

1 个答案:

答案 0 :(得分:1)

您混合了连接参数,请参阅http://www.php.net/manual/en/mysqli.construct.php

function onEachFeature(feature, layer) {
    var popupContent = "<p>I started out as a GeoJSON "
        + feature.geometry.type + ", but now I'm a Leaflet vector!</p>";

    //////////////////////////////////////////////////////////////
    // popupContent property to actual popup
    //////////////////////////////////////////////////////////////
    if (feature.properties && feature.properties.popupContent) {
        popupContent += feature.properties.popupContent;
    }

    layer.bindPopup(popupContent);
    //////////////////////////////////////////////////////////////
}

第一个参数是主机名,然后是用户名和密码。

相关问题