0

I created a mysql database. i have set characters to utf-8 and collation to utf8_general_ci. In database table the text is okay. But when i view it on webpage it looks like this "السلاÙ". When i retrieve this code to my android app i am having the same problem.

php code (index.php)

$con = mysqli_connect("mysql.hostinger.ph", "db_name", "passwrd", "u242667358_test");
if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_set_charset($con, "utf8");

php code (index.php)

require_once('db.php');

$query = "SELECT * FROM BalochiNames ORDER BY RAND() LIMIT 1";   

mysqli_query($con, $query); 

$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
    echo stripslashes($row['BalochiName']);
}
mysqli_close($con);
Danila Ganchar
  • 10,266
  • 13
  • 49
  • 75
Amir Dora.
  • 2,831
  • 4
  • 40
  • 61

0 Answers0