Localhost php_network_getaddresses: getaddrinfo fa

2019-07-03 12:58发布

I am using Localhost with UniServer, running Apache and MySQL. (There is no username or password)
I have the code new mysqli("http://localhost/us_phpmyadmin/","","","url_short"); to connect to my Localhost server, but when I try to run the code mysqli_query("INSERT INTO cut.it VALUES (NULL, $longurl, $shorturl)"); , the error php_network_getaddresses: getaddrinfo failed: No such host is known. comes up on the page. Why is this and how can I get around it?

1条回答
狗以群分
2楼-- · 2019-07-03 13:26

You have to specify the hostname of MySQL instance not a url for phpMyAdmin.

Change

... mysqli("http://localhost/us_phpmyadmin/","","","url_short");

to

... mysqli("localhost", "", "", "url_short");
            ^^^^^^^^^
查看更多
登录 后发表回答