1

hi there I made i database in mysql with collation utf_unicode_ci ; my code is

<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<?php
$db=mysqli_connect("localhost","saeb","123456");
if (!$db)
echo "not connected";
mysqli_select_db($db,'publisher');
$select_book="select * from books";
$result = mysqli_query($db,"$select_book");
$num=mysqli_num_rows($result);
$i=1;
while($i<=$num){
$row=mysqli_fetch_array($result);
    // printf ("%s (%s)\n",$row[0],$row[1]);
    echo "<br>";
echo $row['auther'];
$i++;
}

// for ($i=0; $i <$num ; $i++) {
//   $row=mysqli_fetch_array($result);
//   echo "<br>";
//   echo $row['isbn'];
//   # code...
// }
// var_dump(mysqli_get_charset($db));

 ?>
</html>

but what I see is (i dont know what i must to execute php code in english)

sepidnam ???????? Tanenbaum Abbasnejad

where is problem?why arabic texts converted to ???? ? http://axbabak.ir/uploads/ec1.png http://axbabak.ir/uploads/ec2.png

Saeb Molaee
  • 109
  • 15

1 Answers1

2

after mysqli_connect do mysqli_set_charset($db, 'utf8mb4');
also.. just a guess: try utf8mb4_unicode_ci instead (full unicode support)

Brad Kent
  • 4,982
  • 3
  • 22
  • 26