Last active
December 22, 2015 19:19
-
-
Save frozonfreak/6518922 to your computer and use it in GitHub Desktop.
php pdo db connection check
This file contains hidden or 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
try{ | |
$db = new PDO(DB_STRING, DB_USER, DB_PASSWORD, | |
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); | |
$response = array("status" => 1,"message"=> "DB Connection Succesfull"); | |
die(json_encode($response)); | |
} | |
catch(PDOException $ex){ | |
$response = array("status" => 0,"message"=> "DB Connection Failed"); | |
die(json_encode($response)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment