PHP mysqli_character_set_name() Function
In this chapter you will learn:
- Definition for PHP mysqli_character_set_name() Function
- Syntax for PHP mysqli_character_set_name() Function
- Parameter for PHP mysqli_character_set_name() Function
- Return for PHP mysqli_character_set_name() Function
- Example - returns the default character set for the database connection
Definition
The mysqli_character_set_name() function returns the default character set for the database connection.
Syntax
PHP mysqli_character_set_name() Function has the following syntax.
mysqli_character_set_name(connection);
Parameter
Parameter | Is Required | Description |
---|---|---|
connection | Required. | MySQL connection |
Return
The default character set for the current connection.
Example
returns the default character set for the database connection.
<?php/*from ja v a2 s.co m*/
$con=mysqli_connect("localhost","my_user","my_password","my_db");
if (mysqli_connect_errno($con)){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$charset=mysqli_character_set_name($con);
echo "Default character set is: " . $charset;
mysqli_close($con);
?>
Next chapter...
What you will learn in the next chapter:
- Definition for PHP mysqli_close() Function
- Syntax for PHP mysqli_close() Function
- Parameter for PHP mysqli_close() Function
- Return for PHP mysqli_close() Function
- Example - closes a previously opened database connection
Home » PHP Tutorial » PHP MySQLi Functions