Skip to content

Instantly share code, notes, and snippets.

@stellarcowboy
Last active December 11, 2015 06:39
Show Gist options
  • Save stellarcowboy/4561162 to your computer and use it in GitHub Desktop.
Save stellarcowboy/4561162 to your computer and use it in GitHub Desktop.
Test a database connection before installing WordPress
<?php
$server = "localhost";
$database = "database";
$username = "user";
$password = "password";
$mysqlConnection = mysql_connect($server, $username, $password);
if (!$mysqlConnection)
{
echo "Please try later.";
}
else
{
mysql_select_db($database, $mysqlConnection);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment