Created
April 8, 2015 16:26
-
-
Save LocalCommit/716960abdc3993203333 to your computer and use it in GitHub Desktop.
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 | |
try | |
{ | |
$pdo = new PDO('mysql:host=localhost;dbname=ijdb', 'ijdbuser', 'mypassword'); | |
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
$pdo->exec('SET NAMES "utf8"'); | |
} | |
catch (PDOException $e) | |
{ | |
$output = 'Unable to connect to the database server.'; | |
include 'output.html.php'; | |
exit(); | |
} | |
$output = 'Database connection established.'; | |
include 'output.html.php'; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Script Output</title> | |
</head> | |
<body> | |
<p> | |
<?php echo $output; ?> | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment