Cek koneksi database SQL

Cek Koneksi DataBase SQL

<head><title>Welcome to my excellent blog</title></head>
<h1>Welcome to my excellent blog</h1>
 $dbserver = "CLOUDSQLIP";
$dbuser = "blogdbuser";
$dbpassword = "DBPASSWORD";
// In a production blog, we would not store the MySQL
// password in the document root. Instead, we would store it in a
// configuration file elsewhere on the web server VM instance.
$conn = new mysqli($dbserver, $dbuser, $dbpassword);
if (mysqli_connect_error()) {
        echo ("Database connection failed: " . mysqli_connect_error());
} else {
        echo ("Database connection succeeded.");
Ada pertanyaan? Diskusikan dengan penulis atau pengguna lain
Tautan disalin ke papan klip!