Last active
August 29, 2015 13:57
-
-
Save rumblestrut/9634425 to your computer and use it in GitHub Desktop.
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
| <html> | |
| <head> | |
| <title>Output</title> | |
| </head> | |
| <body> | |
| <?php echo $output; ?> | |
| </body> | |
| </html> |
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
| <?php | |
| try | |
| { | |
| $pdo = new PDO('mysql:host=[insert hostname];dbname=[insert database name]', '[insert database user]', '[insert database password]'); | |
| $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
| $pdo->exec('SET NAMES "utf8"'); | |
| } | |
| catch (PDOException $e) | |
| { | |
| $output = 'Unable to connect to the database server: ' . $e->getMessage(); | |
| include 'output.html.php'; | |
| exit(); | |
| } | |
| $output = 'Database connection established.'; | |
| include 'output.html.php'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment