How to connect with the database using PHP

<?php
$servername = "localhost";
$username = "username";
$password = "password";
$database_name = "databasetesting";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $database_name);

// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
Leave a Comment