Skip to content

Instantly share code, notes, and snippets.

@manfromanotherland
Created July 3, 2014 18:35
Show Gist options
  • Save manfromanotherland/4ae17a866d6fe4948da0 to your computer and use it in GitHub Desktop.
Save manfromanotherland/4ae17a866d6fe4948da0 to your computer and use it in GitHub Desktop.
PHP: How to test connection to database #snippet
<?php
$mysqli = @new mysqli('host', 'user', 'password', 'dabatase');
if ($mysqli->connect_errno) {
die('Connect Error: ' . $mysqli->connect_errno);
}
echo "Connected successfully"
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment