mysql_set_charset

(PHP 5 >= 5.2.3)

mysql_set_charsetSets the client character set

Aviso

Esta extensão tornou-se defasada a partir do PHP 5.5.0 e foi removida no PHP 7.0.0. Em vez disso, as extensões MySQLi ou PDO_MySQL devem ser usadas. Veja também o guia MySQL: escolhendo uma API. Alternativas a esta 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 identificador da conexão não for especificado, a última conexão aberta por mysql_connect() será usada. Se não houver uma conexão anterior, haverá uma tentativa de criar uma como se mysql_connect() tivesse sido chamada sem argumentos. Se nenhuma conexão for encontrada ou estabelecida, um erro de nível E_WARNING será 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.

To Top