Here is an example of PHP code to connect to a MySQL database:
<?php
$servername = "server_name";
$username = "username";
$password = "password";
$dbname = "database_name";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
Replace server_name
, username
, password
, and database_name
with the appropriate values for your database.