mysql_client_encoding

48 views

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():

  1.  
  2. <?php
  3. $con = mysql_connect("localhost","user","password");
  4. if (!$con)
  5.   {
  6.   die("Could not connect: " . mysql_error());
  7.   }
  8.  
  9. $result = mysql_client_encoding($con);
  10. echo "The current character set is: $result";
  11.  
  12. ?>
  13.  

The above example will output something similar to:
The current character set is: latin1

  1.  
  2. <?
  3. function mysql_client_encoding($con = NULL)
  4.    {
  5.      $con = mysql_resolve_link($con);
  6.      return mysql_character_set_name($con);
  7.    }
  8.  
  9. ?>
  10.  



« Molins framework for PHP 5 PHxmltvParser for TV listing for PHP »
Posted on Thursday, February 5th, 2009 at 11:59 am under Mysql Functions | RSS 2.0 Feed

Post Comment

You must be logged in to post a comment.



ComputerEducationWorld.com All Rights Reserved © RSS | CBSE | Education Boards Of India | What is My IP?