Created
July 10, 2018 17:37
-
-
Save darsono1218/004cf7082dd6ee2ae6c0c0520fd9e5e9 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Created by onoPhp.blogspot.com. | |
*/ | |
$host = "localhost"; | |
$username = "root"; | |
$password = ""; | |
try{ | |
$conn = new PDO("mysql:host=$host; dbname=onoPhp", $username, $password); | |
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
echo "berhasil terkoneksi ke database"; | |
return $conn; | |
}catch (PDOException $e){ | |
echo "ERROR : " .$e->getMessage(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment