Iam trying to read a data from mysql database. In my db i checked the data is showing as 'μ' and charset is properly set to 'UTF-8'. But when in PHP when i ran this below code, the output 'μ' is showing as '?'. I tried so many ways by adding different types of charsets and all in the scripts, but all in vain, still its showing as '?'. Can anyone pls help me with it.
My script is below:
header('Content-type: text/html; charset=UTF-8');
$result=mysqli_query($con,"SELECT * FROM comparitive_st_sup WHERE id='$member[$x]' and tender_id='$tender_id'");
$prod_description1 = $row['prod_description'];
$prod_description = mysqli_real_escape_string($con, $prod_description1);
Run below query before executing actual query:
mysqli_query($con, "SET NAMES 'utf8'");
try this your mysqli connection
$mysqli = new mysqli("localhost", "root", "", "test"); $mysqli->set_charset("utf8"); // be careful, this method can be not working (mantainers builds bugs for old php releases), first example is works fine
i hope it will be helpful.