mysql_client_encoding

mysql_client_encoding — Returns the name of the character set

Version: (PHP 4 >= 4.3.0, PHP 5)

Syntax : string mysql_client_encoding  ([resource $link_identifier])

Description :

The mysql_client_encoding() function returns the name of the character set for the current connection. $link_identifier Optional. Specifies the MySQL connection. If not specified, the last connection opened by mysql_connect() or

mysql_pconnect() is used.

Return Values: Returns the default character set name for the current connection.

Example mysql_client_encoding():

<?php
$con   = mysql_connect("localhost","user","password");
if (!$con)
  {
  die("Could not connect: " . mysql_error());
  }

$result = mysql_client_encoding($con); echo "The current character set is: $result";

mysql_close($con); ?>

The above example will output something similar to: The current character set is: latin1
<?
function mysql_client_encoding($con = NULL)
   {
     $con = mysql_resolve_link($con);
     return mysql_character_set_name($con);
   }

?>

Post Comment
Login to post comments