我正在尝试使用以下 PHP 代码连接到 Mysql 数据库。但我收到 2 条错误消息。
Mysql 连接代码:
<?php
define("HOST", "localhost" );
define("USER", "root");
define("PASS", "");
define("DB", "classified");
mysql_connect("HOST", "USER") or die("Cannot connect to database");;
mysql_select_db("DB") or die("Cannot connect to select db");
?>
错误信息:
Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host
is known. in D:\Software\Installed\xampp\htdocs\Classified-website\toplevel\content
\database\databd.php on line 7
Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host
is known. in D:\Software\Installed\xampp\htdocs\Classified-website\toplevel\content
\database\databd.php on line 7
Cannot connect to database.
为什么我收到这 2 个错误消息。如果我在没有定义功能的情况下使用,那么它就可以工作。但..