Skip to content

Instantly share code, notes, and snippets.

@ahanafi
Created October 5, 2020 01:27
Show Gist options
  • Save ahanafi/26784e700cad655bc2369dcfe9e7edd6 to your computer and use it in GitHub Desktop.
Save ahanafi/26784e700cad655bc2369dcfe9e7edd6 to your computer and use it in GitHub Desktop.
Koneksi PHP dan MySQL
<?php
$hostname = "localhost";
$username = "root";
$password = "secret-password";
$dbname = "my_database";
//Koneksi dengan fungsi mysql_connect
$connect = mysql_connect($hostname, $username, $password);
mysql_select_db($dbname, $connect);
//Koneksi dengan fungsi mysqli_connect
$connect = mysqli_connect($hostname, $username, $password, $dbname);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment