Skip to content

Instantly share code, notes, and snippets.

@jamesstout
Last active December 14, 2015 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesstout/5140274 to your computer and use it in GitHub Desktop.
Save jamesstout/5140274 to your computer and use it in GitHub Desktop.
connectToDBMYSQLI()
<?php
function connectToDBMYSQLI($dbConfig, $script, $die = true){
$link = mysqli_connect($dbConfig['server'], $dbConfig['user'], $dbConfig['password'], $dbConfig['database'] );
if (!$link) {
if($die == true){
die("$script script Connect Error (" . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}
else{
return false;
}
}
//echo 'Success... ' . mysqli_get_host_info($link) . "\n";
return $link;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment