Using the following to connect to a MySQL server while using Xampp.
<?php
$mysql_host = 'localhost';
$mysql_user = 'root';
$mysql_pass = '';
$mysql_db = 'a_database';
if(mysqli_connect('$mysql_host','$mysql_user','$mysql_pass') || !mysqli_select_db($mysql_db)) {
die ('could not connect');
}
?>
But I received the following errors:
Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\xampp\htdocs\php\connect.inc.php on line 8
Warning: mysqli_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\xampp\htdocs\php\connect.inc.php on line 8
Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in C:\xampp\htdocs\php\connect.inc.php on line 8 could not connect
How can I fix this problem?