php - Warning: mysqli_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: No such host is known -


i have downloaded wamp server. want establish connection mysql database php , i'm using root user, localhost , name of database. code seems correct when run on wamp, following error: warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: no such host known. in c:\wamp\www\cone.php on line 8 , warning: mysqli_connect(): (hy000/2002): php_network_getaddresses: getaddrinfo failed: no such host known.

also, error message haven't been connected database(from if statement) displayed.

does mean have configuration on server?

here code:

<?php

$dbcon = mysqli_connect('root','', 'localhost', 'people');

`if(!$dbcon)`  `{`     `die('error connecting database');` `}` `echo "success";` 

?>

thank in advance

mysqli_connect('root','', 'localhost', 'people');

you passing root in hostname.

try this

mysqli_connect('localhost','root', '', 'people');

this connect localhost username root passwoord "" , default database people.

maybe better change localhost 127.0.0.1


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -