Created
December 12, 2012 21:00
-
-
Save gaker/4271587 to your computer and use it in GitHub Desktop.
quick and dirty MySQL connection test script for someone.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dbname = ''; | |
$hostname = ''; | |
$user = ''; | |
$pass = ''; | |
try { | |
$dbh = new PDO('mysql:host='.$hostname.';dbname='.$dbname, $user, $pass); | |
$dbh->exec("SET CHARACTER SET utf8"); | |
$dbh = null; | |
echo "it worked!\n"; | |
} catch (PDOException $e) { | |
echo "Error!: " . $e->getMessage() . "<br/>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment