Last active
October 5, 2020 01:52
-
-
Save ahanafi/87483bde8ffc4385629a224bf28ce005 to your computer and use it in GitHub Desktop.
Koneksi PHP dan MySQL dengan PDO
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 | |
$hostname = "localhost"; | |
$username = "root"; | |
$password = "secret-password"; | |
$dbname = "my_database"; | |
try { | |
$connect = new PDO("mysql:dbname=$dbname;host=$hostname", $username, $password); | |
} catch (PDOException $e) { | |
echo 'Connection failed: ' . $e->getMessage(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment