Skip to content

Instantly share code, notes, and snippets.

@ianjuma
Created April 1, 2016 08:28
Show Gist options
  • Save ianjuma/28d997763a26271e6e9d872e442f545c to your computer and use it in GitHub Desktop.
Save ianjuma/28d997763a26271e6e9d872e442f545c to your computer and use it in GitHub Desktop.
Connect to DB
<?php
//This allows you to connect to your DB
//connection credentials
$servername = getenv("IP");
$username = getenv("C9_USER");
$password = "";
$database = "lakehub";
$dbport = 3306;
//Connect to DB
$db = new mysqli($servername, $username, $password, $database,$dbport);
//Call
if($db->connect_error){
header('content-type: text/plain');
die("error encountered.");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment