Skip to content

Instantly share code, notes, and snippets.

@333crist
Last active Jan 26, 2018
Embed
What would you like to do?
koneksi
<?php
//Ini adalah Sample syntax format PHP Versi diatas 5
$db_host = "localhost"; //variable tentang isian host
$db_user = "root"; //variable tentang isian user
$db_pass = ""; //variable tentang isian password
$db_name = "database_anda"; //variable tentang isian database
$conn = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
if(mysqli_connect_errno()){
echo 'Koneksi gagal! : '.mysqli_connect_error();
}else{
echo 'Koneksi berhasil';
}
?>
<?php
//Ini adalah Sample syntax format PHP Versi 5
$db_host = "localhost"; //variable tentang isian host
$db_user = "root"; //variable tentang isian user
$db_pass = ""; //variable tentang isian password
$db_name = "database_anda"; //variable tentang isian database
$conn=mysql_connect($db_host, $db_user, $db_pass);
$result=mysql_select_db($db_name);
if ($result)
{
echo "Database Ada";
}
else
{
echo "Database Tidak Ada";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment