Created
November 13, 2013 19:57
-
-
Save ron4stoppable/7455344 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
<?php | |
$link = mysqli_connect('localhost', 'user', 'password'); //replace user with root of the user name | |
if (!$link) | |
{ | |
$output = 'Unable to connect to the database server.'; // If connection to MySQL server fails | |
include 'output.html.php'; // error message will be stored $output | |
exit(); | |
} | |
if (!mysqli_set_charset($link, 'utf8')) | |
{ | |
$output = 'Unable to set database connection encoding.'; | |
include 'output.html.php'; | |
exit(); | |
} | |
if (!mysqli_select_db($link, 'some-table')) | |
{ | |
$output = 'Unable to locate the some-table database.'; | |
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