gpt4 book ai didi

php - mysql_connect() 问题

转载 作者:行者123 更新时间:2023-11-30 23:58:49 25 4
gpt4 key购买 nike

<分区>

我正在尝试使用以下 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 条错误消息。如果我在没有定义功能的情况下使用,那么它就可以工作。但是..

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com