xxxxxxxxxx
<?php
// Database configuration
$host = 'localhost';
$username = 'your_username';
$password = 'your_password';
$dbname = 'your_database';
// Create a new connection
$conn = new mysqli($host, $username, $password, $dbname);
// Check for connection errors
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Set UTF-8 encoding
$conn->set_charset("utf8");
// Perform database operations...
// Close the connection
$conn->close();
?>