mysql-client-encoding() Function in PHP

What is mysql-client-encoding function in PHP?
How does mysql-client-encoding() works?

Explanation

The mysql_client_encoding() returns the name of the character set.
Syntax
string mysql_client_encoding ( [resource link_identifier])

mysql_client_encoding() returns the default character set name for the current connection.
Example

<?php
// Attempt to connect to the default database server
$link = mysql_connect("mysql_host", "mysql_user", "mysql_password")
or die ("Could not connect");
$charset = mysql_client_encoding($link);
echo "The current character set is: $charsetn";
?>

RESULT:
The current character set is: latin1
See also: mysql_real_escape_string()

PHP Topics


Ask Questions

Ask Question