When we want to display regional language from the database , we have to use utf8 formate
so
mysqli_set_charset($conn,"utf8");
this line of the code must be added after the connection before the SQL
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//header("Content-Type: text/html;charset=UTF-8");
$mysql_hostname = '*************';
$mysql_user = '******';
$mysql_password = '*********';
$mysql_database = '**********';
//echo "*************************************";
//var_dump(function_exists('mysqli_connect'));
$conn = new mysqli($mysql_hostname, $mysql_user, $mysql_password, $mysql_database);
if (!$conn){
die("Connection error: " . mysqli_connect_error());
}
// Change character set to utf8
mysqli_set_charset($conn,"utf8");
$sql = "SELECT * FROM wp_bestcinemaposts ";
$rows = array();
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
while ($row = mysqli_fetch_assoc($result)) {
$res=array();
$rows[] = $row;
$post_parent=$row['ID'];
//echo '***************',$row['post_content'];
}
print json_encode($rows);
/
?>
so
mysqli_set_charset($conn,"utf8");
this line of the code must be added after the connection before the SQL
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//header("Content-Type: text/html;charset=UTF-8");
$mysql_hostname = '*************';
$mysql_user = '******';
$mysql_password = '*********';
$mysql_database = '**********';
//echo "*************************************";
//var_dump(function_exists('mysqli_connect'));
$conn = new mysqli($mysql_hostname, $mysql_user, $mysql_password, $mysql_database);
if (!$conn){
die("Connection error: " . mysqli_connect_error());
}
// Change character set to utf8
mysqli_set_charset($conn,"utf8");
$sql = "SELECT * FROM wp_bestcinemaposts ";
$rows = array();
$result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
while ($row = mysqli_fetch_assoc($result)) {
$res=array();
$rows[] = $row;
$post_parent=$row['ID'];
//echo '***************',$row['post_content'];
}
print json_encode($rows);
/
?>