Last active
March 13, 2018 14:58
-
-
Save wichaksono/40975200f9c85dc7f6479417e803c59e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** | |
* Informasi akun untuk akses database | |
* @var $dbhost host database biasanya diisi 'localhost' atau '127.0.0.1' | |
* @var $dbuser username database, untuk xampp biasanya diisi "root" | |
* @var $dbpass password database, untuk xampp biasanya dikosongkan | |
* @var $dbname nama database yang akan diakses | |
*/ | |
$dbhost = 'localhost'; | |
$dbuser = 'root'; | |
$dbpass = ''; | |
$dbname = 'belajar'; | |
// Fungsi untuk koneksi ke database { menggunakan MySQLi Object Oriented } | |
$db = new mysqli($dbhost,$dbuser,$dbpass,$dbname); | |
// Check hasil fungsi koneksi berhasil atau tidak | |
// Jika terjadi Error | |
if ($db->connect_error) { | |
// Sistem dihentikan | |
die('Terjadi Kegagalan : '. $db->connect_error ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment