i want to display unicode text in my site from mySql Database, im created table in unicode collation, but i can't display text by unicode text please refer bellow code i created.
<!Doctype html>
<html>
<head>
<title>Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
*{
font-family:Latha;
}
</style>
</head>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbName = "mydb";
//Create connection
header("content-type: text/html; charset=UTF-8");
$conn = new mysqli($servername, $username, $password, $dbName);
//Check connection
if($conn->connect_error){
die("Connection Failed : ". $conn->connect_error);
}
$sql="select txt, txt1,txt2 from dav";
//mysqli_set_charset($sql, 'utf8');
$result=$conn->query($sql);
if($result->num_rows>0){
//output data
while ($row=$result->fetch_assoc()){
echo "<div><p>" .$row["txt"]. "</p><p>" .$row["txt1"]. "</p><p>" . $row["txt2"]. "</p></div>";
}
}
else{
echo "No data found";
}
$conn->close();
?>
</body>
</html>
and output is like this
?????????? ????? ?????? ???????? ???????????? ????????? ??????.
?????????? ????? ?????? ???????? ???????????? ????????? ??????.
?????????? ????? ?????? ???????? ???????????? ????????? ??????.
but i want like this
வான்நின்று உலகம் வழங்கி வருதலால் தான்அமிழ்தம் என்றுணரற் பாற்று. வான்நின்று உலகம் வழங்கி வருதலால் தான்அமிழ்தம் என்றுணரற் பாற்று. வான்நின்று உலகம் வழங்கி வருதலால் தான்அமிழ்தம் என்றுணரற் பாற்று.
Please help me to fix this.