Does Mysql Arabic return?

Asked

Viewed 28 times

1

I have the following problem: In my PHP code I’m making a select in a table containing information in Arabic اختبار. However in PHP it is returning ?????.

I’m using Php 5.2.10.

1 answer

1


It may be necessary to define the charset, use the function mysqli_set_charset.

See an example (taken from the documentation):

$mysqli = new mysqli("localhost", "my_user", "my_password", "test");

if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

printf("Initial character set: %s\n", $mysqli->character_set_name());

/* change character set to utf8 */
if (!$mysqli->set_charset("utf8")) {
    printf("Error loading character set utf8: %s\n", $mysqli->error);
    exit();
} else {
    printf("Current character set: %s\n", $mysqli->character_set_name());
}

$mysqli->close();
  • worked well using mysql_set_charset. Thanks.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.