Showing posts with label Open a Connection to MySQL. Show all posts
Showing posts with label Open a Connection to MySQL. Show all posts

Friday, February 6, 2015

Open a Connection to MySQL

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

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);

echo "Connected successfully";
?>