How to make database connection in PHP?
BY Best Interview Question ON 01 May 2020
Example
$servername = "your hostname";
$username = "your database username";
$password = "your database password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Not Connected: " . $conn->connect_error);
}
echo "Connected";