Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Konfigurasi database anda
- $host = "localhost";
- $dbname = "dbLogin";
- $username = "root";
- $password = "root";
- try {
- // Buat Object PDO baru dan simpan ke variable $db
- $db = new PDO("mysql:host={$host};dbname={$dbname}", $username, $password);
- // Mengatur Error Mode di PDO untuk segera menampilkan exception ketika ada kesalahan
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- } catch (PDOException $exception){
- die("Connection error: " . $exception->getMessage());
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement