mysql_set_charset

(PHP 5 >= 5.2.3)

mysql_set_charsetSets the client character set

Aviso

Esta extensão está obsoleta desde o PHP 5.5.0 e foi removida no PHP 7.0.0. Utilize MySQLi ou PDO_MySQL alternativamente. Veja também MySQL: escolhendo uma API e FAQs relacionadas para mais informações. Alternativas a essa função incluem:

Descrição

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

Sets the default character set for the current connection.

Parâmetros

charset

A valid character set name.

link_identifier

A conexão MySQL. Se o link identifier não for especificado, o último link aberto por mysql_connect() é utilizado. Se uma conexão anterior não existir será tentado criar um a partir de uma chadama a mysql_connect() sem nenhum argumento. Se nenhuma conexão for encontrada ou estabelecida, um erro nível E_WARNING é gerado.

Valor Retornado

Retorna TRUE em caso de sucesso ou FALSE em caso de falha.

Notas

Nota:

This function requires MySQL 5.0.7 or later.

Nota:

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.