How to connect to MySQL with PHP

MySQL database connection settings can be found at Winhost Control Panel > Sites > the domain name > MySQL > Manage (applicable database).  In the example script below, replace ServerName, DatabaseUsername and DatabasePassword.

<?php
$servername = "ServerName";
$username = "DatabaseUsername";
$password = "DatabasePassword";

$conn = new mysqli($servername, $username, $password);

if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>

For more information on mysqli_connect see https://www.php.net/manual/en/mysqli.construct.php.