Created
August 4, 2010 18:47
-
-
Save bcalloway/508598 to your computer and use it in GitHub Desktop.
Basic test for db connection
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 | |
//test database connection | |
// Address error handling. | |
ini_set ('display_errors', 1); | |
error_reporting (E_ALL & ~E_NOTICE); | |
// Attempt to connect to MySQL | |
if ($dbc = mysql_connect ($host, $user, $pass)) { | |
print '<p>Successfully connected to MySQL.</p>'; | |
mysql_close(); // Close the connection. | |
} else { | |
die ('<p>Could not connect to MySQL because: <b>' . mysql_error() . '</b></p>'); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment