Koneksi Database

[insert_php]
$servername = “localhost1”;
$database = “niagahos_namadatabase”;
$username = “niagahos_user”;
$password = “passworddatabase”;

// untuk tulisan bercetak tebal silakan sesuaikan dengan detail database Anda

// membuat koneksi

$conn = mysqli_connect($servername, $username, $password, $database);

// mengecek koneksi

if (!$conn) {

die(“Koneksi gagal: ” . mysqli_connect_error());

}
echo “Koneksi berhasil”;
mysqli_close($conn);
[/insert_php]