Create a file named config.php where you will connect to the database. Put the following code in it:
... [READ MORE]
$mysqli = new mysqli("localhost", "username", "password", "db");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$bd = mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("db",$bd) or die(mysql_error());
?>
Check whether mysqli connection is made or not in php
if ($mysqli->ping()) {
echo ("Our connection is ok!n");
} else {
printf ("Error: %sn", $mysqli->error);
}