I want to set UTF-8 in this file
When I select data from database it's will be like this
**??????????**
<?php
define("__HOST__", "localhost");
define("__USER__", "root");
define("__PASS__", "root");
define("__BASE__", "db_blog");
class DB {
private $con = false;
private $data = array();
public function __construct() {
$this->con = new mysqli(__HOST__, __USER__, __PASS__, __BASE__);
if(mysqli_connect_errno()) {
die("DB connection failed:" . mysqli_connect_error());
}
}
public function qryPop() {
$sql = "SELECT * FROM `tb_blog` ORDER BY `id`" ;
$qry = $this->con->query($sql);
if($qry->num_rows > 0) {
while($row = $qry->fetch_object()) {
$this->data[] = $row;
}
} else {
$this->data[] = null;
}
$this->con->close();
}
?>