Last active
August 29, 2015 14:17
-
-
Save epierpont/5f92c60ce10af05a1cee to your computer and use it in GitHub Desktop.
PHP - Test MySQL database 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 | |
$conn = mysql_connect( "host", "user", "pass" ); | |
if ( !$conn ) { | |
echo "Unable to connect to server."; | |
} else { | |
$db = mysql_select_db( "database", $conn ); | |
if ( !$db ) { | |
echo "Unable to select database."; | |
} else { | |
echo "Successfully connected to database!"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment