I am trying to get hindi data from database but it returns ???? everytime.
Other answers on StackOverflow told to use mysqli_set_charset($conn, 'utf8');
but this is not working in my case.
Please check the below code.
<?php
class Quotes {
public $id;
public $position;
public $quote;
public $image_url;
private $conn;
private $table_name;
public function __construct($db) {
$this->conn = $db;
$this->table_name = "tbl_y_test";
}
//read all data
public function getAllData() {
$sql_query = "SELECT * FROM ".$this->table_name." ORDER BY `position`";
mysqli_set_charset($conn, 'utf8');
$obj = $this->conn->prepare($sql_query);
$obj->execute();
return $obj->get_result();
}
}
?>