I have installed mysql and uploaded data to the database. When I view the data in phpadmin the unicode show fine.
In my php script I try to get the data from the database and it does not come in unicode but it shows up as in the below picture.
This is my php script. Please let me know where I have gone wrong.
<?php
$servername = "localhost";
$username = "root";
$password = "xxxxx";
$dbname = "learnTV";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//mysql_query ("set character_set_results='utf8'");
$sql = "select l_id, t_id, net,file, dur, s_desc, e_desc, sex, name, sin_desc from Lessons";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "'" . $row["l_id"] . "','" .$row["t_id"] . "','" .$row["net"] . "','" .$row["file"] . "','" .$row["dur"] . "','" .$row["s_desc"] . "','" .$row["e_desc"] . "','" .$row["sex"] . "','" .$row["name"]. "','" . $row["sin_desc"] . "----<br/>";
}
} else {
echo "0 results";
}
$conn->close();
?>