0

I am trying to print out text and unicode. I get question marks as an output for all unicode. I do not want to replace it but I want to show the character that was put in it originally. Can someone tell me how? Using PHP and a MySQL database that has the correct symbols

Code:

if (!$db) {
    die("Connection failed: " . mysqli_connect_error());
}

$sql = "SELECT * FROM `XP` ORDER BY totalxp DESC";
$result = mysqli_query($db, $sql);

if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        printf ('<div class="user">');
        printf ('<div class="content">');
        printf  ('<div class="profile_pic_holder">');
        printf ('<img class="profile_pic" src="' . $row["profilePic"] . '" >' . "<br>");
        printf ('</div><div class="text">');
#                          printf ("ID: " . $row["ID"] . "<br>");
        printf ($row["Nickname"] . "<br>");
#                          printf ("UserID: " . $row["UserID"] . "<br>");
        printf ("XP: " . thousandsCurrencyFormat($row["xp"]) . "<br>");
        printf ("Level: " . $row["level"] . "<br>");
        printf ('<div id="' . $row["UserID"] . '"></div>');
        printf ('<script>$("#' . $row["UserID"] . '").progressbar({value: ' . $row["percentageToNextLvl"] . ', "ui-progressbar-overlay": "./assets/lava.gif"});</script>');
        printf ("<br>");
        printf ('</div>');
        printf ('</div>');
        printf ('</div>');
    }
} else {
    echo "0 results";
}

DB is the Database connection How can I make it that the Nickname will be printed as unicode characters that are in the database and not just a question marks?

Neeku
  • 3,601
  • 8
  • 32
  • 43
  • https://stackoverflow.com/questions/275411/php-output-showing-little-black-diamonds-with-a-question-mark – sunshine Apr 14 '19 at 11:04
  • See "question mark" (not black diamond, unless it is such) in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James Apr 21 '19 at 05:06

0 Answers0