MySQL Arabic returns?

1

I have the following problem: In my PHP code I am making a select in a table that contains information in Arabic اختبار . But in PHP it is returning ????? .

I'm using Php 5.2.10.

    
asked by anonymous 17.10.2016 / 19:59

1 answer

1

You may need to set charset , use the 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();
    
17.10.2016 / 20:14