/* change character set to utf8 */
if (!$mysqli->set_charset("utf8")) {
printf("Error loading character set utf8: %s\n", $mysqli->error);
} else {
printf("Current character set: %s\n", $mysqli->character_set_name());
}
$mysqli->close();
?>
Procedural style
<?php
$link = mysqli_connect('localhost', 'my_user', 'my_password', 'test');
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* change character set to utf8 */
if (!mysqli_set_charset($link, "utf8")) {
printf("Error loading character set utf8: %s\n", mysqli_error($link));
} else {
printf("Current character set: %s\n", mysqli_character_set_name($link));
}
mysqli_close($link);
?>
The above examples will output:
Current character set: utf8
See Also
mysqli_character_set_name
mysqli_real_escape_string
List of character sets that MySQL supports
20.7.3.9.50. mysqli::set_local_infile_default,
Copyright 1997-2012 the PHP Documentation Group. [2230]
•
mysqli::set_local_infile_default
mysqli_set_local_infile_default
Unsets user defined handler for load local infile command
Description
void mysqli_set_local_infile_default(
mysqli link);
Deactivates a
mysqli_set_local_infile_handler.
Parameters
MySQL Improved Extension (Mysqli)
LOAD DATA INFILE LOCAL
mysqli_set_local_infile_default
handler previously set with
2420
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers