- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我在一个主要使用数据库的网站上工作。问题是我收到以下错误:mysqli_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known
我无法弄清楚如何解决它。我已经对连接进行了五次检查,似乎没问题。
function connect($hostname, $username, $password, $database)
{
$conid = mysqli_connect($hostname, $username, $password, TRUE);
if($conid == FALSE)
{
if(DEBUG == TRUE)
{
show_error("MySQL Connection using `$hostname`, `$username`, `$password` was refused");
}
return;
}
else
{
$dbid = mysqli_select_db($database, $conid);
if($dbid == FALSE)
{
if(DEBUG == TRUE)
{
show_error("MySQL could not connect to database `$database`");
}
return;
}
else
{
self::$connections[] = $conid;
self::$connection = $conid;
}
}
}
代码是在 2010 年编写的,然后以某种方式运行。可以修复吗?
最佳答案
这是服务器托管问题。您必须检查托管。
您还可以通过此链接阅读更多提示:http://albertech.net/2011/05/fix-php_network_getaddresses-getaddrinfo-failed-name-or-service-not-known/
关于php - mysqli_connect() : php_network_getaddresses: getaddrinfo failed: Name or service not known,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22946763/
在查看各种 mysql 和 php 代码时,我看到数据库连接是用和号写的还是不写的: $db = mysqli_connect (db_host, db_user, db_pw, db_name);
我在第 15-16-17 行有以下代码: 此行放置在 setup.php 文件中,该文件包含在 index.php 文件中(位于文档顶部,第 1 行) 数据库位于wampserver,用户名、密码
这个问题在这里已经有了答案: Reference: What is variable scope, which variables are accessible from where and wha
我正在阅读一个教程,其中指出连接到 MySQL 数据库的语法如下: $connection = mysqli_connect("hostname", "username", "password");
什么是mySQL中的“forks” 最佳答案 它的数据库名称 mysqli_connect(host,username,password,dbname,port,socket); Parameter
Closed. This question needs details or clarity。它当前不接受答案。
这里是初学者问题。我正在学习php和mysql。我有一个使用本地服务器创建的网站。数据库在 MAMP 上与其链接良好。我现在尝试使用 iPage 将其上传到共享服务器。它将无法连接。 这是我的代码
在我的 PHP 脚本中,我有: $con = mysqli_connect("12.345.67.89", "root", "password", "databasename"); if ($con)
我已经在几个线程中看到了这个问题,但是我有机会尝试的建议已经奏效了。 我想将所有函数(和一些变量)存储在一个文件中,然后将该文件包含在我的页面中。这是我的 includes.php: 在我的测试中,
我最近在这种情况下没有改变任何东西,但最近我的 mysqli_connect() 到远程服务器非常慢(大约有一半时间达到 30 秒的最大执行时间)。当它工作时,响应时间在 28 到 30 秒之间。 我
好的,这就是我现在的问题。我正在使用 PHP 5.5.12 和 MySQL 5.6.17。在我的 php 设置中检查了 php mysqli_connect,但仍然出现错误。有什么帮助吗?提前致谢。
mysql_connect 会给我一个错误报告。mysqli_connect 给我一个空白页。 这确实给我一个错误报告 $mysql_con = mysql_connect($mysql_host,
当我调用 var_dump(function_exists('mysqli_connect')) 时,它返回了 bool(false) 而我的 mysqli_connect 函数没有工作,eventh
我最近不得不重新安装我的 wamp 包,所以我得到了一个新的 apache 2.2.22、php 5.4.3 和 mysql 5.5.24。 发生的一个重大变化是页面生成时间。我挖了一下,发现对 my
我正在尝试连接到远程服务器。我认为问题出在端口号上,但是当我尝试报告错误时,我没有得到任何信息。 $db_host = 'MY.IP.ADD.RESS:3306'; $db_user
我安装了 apache、php 和 mysql。现在,当我执行 php 代码时,mysqli_connect() 不工作,它也没有在 die 中显示消息。 $dbc=mysqli_connect('
我想知道 mysqli_connect() 是否会在脚本结束时自动关闭。我知道,mysql_connect() 确实如此,但我说的是改进的 mysqli_connect()。我还找到了已回答的问题,说
我如何捕捉 mysqli_connect() 的警告 例子 if (!$connection2 = mysqli_connect($host, $username, $password, $name)
mysqli_connect() 的 PHP 手册建议检查返回值并在屏幕上显示错误消息。 $link = mysqli_connect("127.0.0.1", "my_user", "my_pass
我确信这个问题很容易回答,但我不明白。当我尝试在函数中连接时,它会抛出“用户''@'localhost'访问被拒绝”错误。看起来该数组在数组中不可用,因为错误表明我没有输入用户名和密码。 代码是: $
我是一名优秀的程序员,十分优秀!