Tuesday, 25 October 2016

MySQLi Connect

Assalamualaikum, untuk post kali ni saya akan beri kod untuk connect ke database menggunakan MYSQLi.

Simple dan Mudah.

<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "DB";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$conn->close();
?>

Sekian, Terima Kasih. Diharap kod ini dapat membantu anda memulakan koding. Semoga Berjaya. 

Writer :
25/10/2016

0 comments:

Post a Comment