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
  • 8,684
  • 12
  • 42
  • 65
Amir Dora.
  • 2,777
  • 4
  • 31
  • 53

0 Answers0