Last active
January 26, 2018 18:22
-
-
Save 333crist/c22912e051550e2080abde8ec269bfd4 to your computer and use it in GitHub Desktop.
koneksi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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