I
I
Ilya2015-08-09 22:22:07
PHP
Ilya, 2015-08-09 22:22:07

How to set utf-8 for "mysqli_connect_error"?

Good day!
There is an error message about connecting to MySQL:

// Error message
    if (mysqli_connect_errno()) { 
        echo "<div id=\"mysqli-error\">Подключение к серверу MySQL невозможно. Проверьте конфигурацию подключения.<br /><font>Причина ошибки: ", mysqli_connect_error()."</font></div>";
    }

I am using OpenServer. I think the question is clear, I don't know what else to add. Except:
Encoding "mysqli_connect_error" - Windows-1251
Naturally, on a page with utf-8 encoding, it returns shorthands.
Thanks to all who responded!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton B, 2015-08-09
@bigton

mysqli_set_charset() ?

D
Denis Kotlyarov, 2015-08-09
@denisandroid

I don’t know why you need windows 1251 on sites and Microsoft uses utf 8, basically, well, if you need it.
Tembolee 1251!
51 encoding was removed in Windows 7 :)
This encoding was supported by xp, vista, replaced by 1252.
You can set the encoding you need by default in .htass (I don’t remember how), or set the database settings in phpmyadmin and select the desired encoding.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question