array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'function.mysql-set-charset.php', 1 => 'mysql_set_charset', 2 => 'Sets the client character set', ), 'up' => array ( 0 => 'ref.mysql.php', 1 => 'MySQL Функції', ), 'prev' => array ( 0 => 'function.mysql-select-db.php', 1 => 'mysql_select_db', ), 'next' => array ( 0 => 'function.mysql-stat.php', 1 => 'mysql_stat', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mysql/functions/mysql-set-charset.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

mysql_set_charset

(PHP 5 >= 5.2.3)

mysql_set_charsetSets the client character set

Увага

Це розширення застаріле, починаючи з PHP 5.5.0, та вилучене з PHP 7.0.0. Натомість використовуються розширення MySQLi або PDO_MySQL. Докладніше описано у керівництві MySQL: вибір API. Цю функцію можна замінити на:

Опис

mysql_set_charset(string $charset, resource $link_identifier = NULL): bool

Sets the default character set for the current connection.

Параметри

charset

A valid character set name.

link_identifier

З'єднання MySQL. Якщо не задано, буде обрано останнє з'єднання, встановлене функцією mysql_connect(). Якщо з'єднатися не вдалось, функція спробує встановити нове, ніби викликавши функцію mysql_connect() без параметрів. Якщо з'єднання не вдалося знайти або встановити, буде виведено повідомлення рівня E_WARNING

Значення, що повертаються

Повертає true у разі успіху або false в разі помилки.

Примітки

Зауваження:

This function requires MySQL 5.0.7 or later.

Зауваження:

This is the preferred way to change the charset. Using mysql_query() to set it (such as SET NAMES utf8) is not recommended. See the MySQL character set concepts section for more information.

Прогляньте також