May 31, 2020

Mawan.my.id

Blog Mawan di DobelHost

koneksi.php

<?php
// Ganti 5 baris di bawah ini dengan data milik anda.
$host      = '127.0.0.1';
$database  = 'u12345678_tgs1';
$username  = 'mawan';
$password  = 'rahasia';
$charset   = 'utf8';

// Melakukan koneksi ke database.
$dsn = "mysql:host=$host;dbname=$database;charset=$charset";
$opt = [
    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES   => false,
];
$pdo = new PDO($dsn, $username, $password);
?>

Jangan lupa, kode di nomor baris 4 sampai 6 harus diganti, disesuaikan dengan data milik masing-masing.

Leave a Reply

Your email address will not be published. Required fields are marked *