Sanju Menon Sanju Menon - 1 month ago 4x
PHP Question

Some characters(μ) showing as ??.php/mysql

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:

ini_set("default_charset", "UTF-8");
header('Content-type: text/html; charset=UTF-8');

ini_set("display_errors", 1);


$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);
echo $prod_description;
echo '<br>';


try this,

Run below query before executing actual query:

mysqli_query($con, "SET NAMES 'utf8'");


try this your mysqli connection

$mysqli = new mysqli("localhost", "root", "", "test");
// 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.