How Mysql Connection Error to user

fixes #207
This commit is contained in:
Felix Favre 2015-08-26 14:51:00 +02:00
parent 2df2398b87
commit 1af6b8cf20
1 changed files with 23 additions and 21 deletions

View File

@ -86,8 +86,10 @@ function sql_connect($host, $user, $pass, $db) {
global $sql_connection;
$sql_connection = new mysqli($host, $user, $pass, $db);
if ($sql_connection->connect_errno)
if ($sql_connection->connect_errno) {
error("Unable to connect to MySQL: " . $sql_connection->connect_error);
return sql_error("Unable to connect to MySQL: " . $sql_connection->connect_error);
}
$result = $sql_connection->query("SET CHARACTER SET utf8;");
if (! $result)