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?
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");
^^^^^^^^^
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.